Merge branch 'main' of github.com:PenguinOwl/QuidProQuo
This commit is contained in:
commit
98de7f7aea
@ -1,8 +1,11 @@
|
|||||||
package top.penowl.quidproquo;
|
package top.penowl.quidproquo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -21,6 +24,24 @@ public class Commands implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
// display help
|
// display help
|
||||||
|
return false;
|
||||||
|
} else if (args[0].toLowerCase().equals("list")) {
|
||||||
|
List<String> ritualNames = new ArrayList<String>(recipes.keySet());
|
||||||
|
int max = ritualNames.size() - 1;
|
||||||
|
int maxPages = max / 10;
|
||||||
|
int page = 0;
|
||||||
|
try {
|
||||||
|
page = Math.min(Math.max(Integer.parseInt(args[1]) - 1, 0), maxPages);
|
||||||
|
} catch(Exception e) {
|
||||||
|
}
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append(ChatColor.DARK_PURPLE + "======== Rituals ======== " + ChatColor.YELLOW + "Page " + String.valueOf(page + 1) + " / " + String.valueOf(maxPages + 1));
|
||||||
|
builder.append("\n" + ChatColor.GREEN);
|
||||||
|
for (int i = page * 10; i < Math.min(page * 10 + 10, max + 1); i++) {
|
||||||
|
builder.append(ritualNames.get(i));
|
||||||
|
builder.append("\n" + ChatColor.GREEN);
|
||||||
|
}
|
||||||
|
sender.sendMessage(builder.toString());
|
||||||
return true;
|
return true;
|
||||||
} else if (recipes.containsKey(args[0].toUpperCase())) {
|
} else if (recipes.containsKey(args[0].toUpperCase())) {
|
||||||
// display recipe info
|
// display recipe info
|
||||||
|
@ -30,9 +30,6 @@ public class QuidProQuo extends JavaPlugin {
|
|||||||
getLogger().info("Loading rituals...");
|
getLogger().info("Loading rituals...");
|
||||||
getServer().getPluginManager().registerEvents(new Events(), this);
|
getServer().getPluginManager().registerEvents(new Events(), this);
|
||||||
|
|
||||||
// register command handler
|
|
||||||
getCommand("ritual").setExecutor(new Commands(rituals));
|
|
||||||
|
|
||||||
// register all rituals
|
// register all rituals
|
||||||
rituals.add(new HealRitual());
|
rituals.add(new HealRitual());
|
||||||
rituals.add(new WoolingRitual());
|
rituals.add(new WoolingRitual());
|
||||||
@ -54,6 +51,9 @@ public class QuidProQuo extends JavaPlugin {
|
|||||||
getLogger().info("Loaded a " + ritual.name + " ritual.");
|
getLogger().info("Loaded a " + ritual.name + " ritual.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// register command handler
|
||||||
|
getCommand("ritual").setExecutor(new Commands(rituals));
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
@ -20,9 +20,7 @@ public class HitRitual extends Ritual {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(Player caster, Player target, Location location) {
|
public void execute(Player caster, Player target, Location location) {
|
||||||
target.playSound(target.getLocation(), Sound.HURT_FLESH, 1, 1);
|
target.playSound(target.getLocation(), Sound.HURT_FLESH, 1, 1);
|
||||||
for(int i = 0; i < 3; i ++) {
|
//target.damage(1.0);
|
||||||
target.playSound(target.getLocation(), Sound.SUCCESSFUL_HIT, 1, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
main: top.penowl.quidproquo.QuidProQuo
|
main: top.penowl.quidproquo.QuidProQuo
|
||||||
name: QuidProQuo
|
name: QuidProQuo
|
||||||
version: 0.1
|
version: 0.1
|
||||||
|
commands:
|
||||||
|
ritual:
|
||||||
|
description: Check ritual information.
|
||||||
|
aliases: [quidproquo, rt]
|
||||||
|
permission: quidproquo.command
|
||||||
|
permission-message: You do not have /<permission>
|
||||||
|
usage: |
|
||||||
|
§3/ritual list - List all available rituals.
|
||||||
|
§3/ritual <ritual> - See the information on a ritual
|
Loading…
x
Reference in New Issue
Block a user