Add command/item to join/leave a redstone minigame
This commit is contained in:
@@ -45,6 +45,7 @@ import org.bukkit.material.MaterialData;
|
|||||||
import org.bukkit.material.Stairs;
|
import org.bukkit.material.Stairs;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
import org.bukkit.scoreboard.Objective;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class AnuraCore extends JavaPlugin implements PluginMessageListener {
|
public class AnuraCore extends JavaPlugin implements PluginMessageListener {
|
||||||
@@ -153,12 +154,16 @@ public class AnuraCore extends JavaPlugin implements PluginMessageListener {
|
|||||||
|
|
||||||
Inventories.registerInventory("LOBBY", "lobby_inv", ChatColor.DARK_BLUE);
|
Inventories.registerInventory("LOBBY", "lobby_inv", ChatColor.DARK_BLUE);
|
||||||
Inventories.putIntoInventory("LOBBY", 0, Inventories.buildItems(Material.SLIME_BALL, "inv_lobby_jump", ChatColor.DARK_GREEN));
|
Inventories.putIntoInventory("LOBBY", 0, Inventories.buildItems(Material.SLIME_BALL, "inv_lobby_jump", ChatColor.DARK_GREEN));
|
||||||
Inventories.putIntoInventory("LOBBY", 3, Inventories.buildItems(Material.WATER_BUCKET, "inv_lobby_swim", ChatColor.DARK_BLUE));
|
Inventories.putIntoInventory("LOBBY", 1, Inventories.buildItems(Material.WATER_BUCKET, "inv_lobby_swim", ChatColor.DARK_AQUA));
|
||||||
|
Inventories.putIntoInventory("LOBBY", 3, Inventories.buildItems(Material.EXP_BOTTLE, "inv_lobby_xpbattle", ChatColor.GREEN));
|
||||||
|
Inventories.putIntoInventory("LOBBY", 4, Inventories.buildItems(Material.POTION, "inv_lobby_pool", ChatColor.BLUE));
|
||||||
Inventories.putIntoInventory("LOBBY", 6, Inventories.buildItems(Material.WOOD_DOOR, "tp_to_spawn", ChatColor.GOLD));
|
Inventories.putIntoInventory("LOBBY", 6, Inventories.buildItems(Material.WOOD_DOOR, "tp_to_spawn", ChatColor.GOLD));
|
||||||
Inventories.putIntoInventory("LOBBY", 8, Inventories.buildItems(Material.ENDER_PEARL, "inv_lobby_back", ChatColor.YELLOW));
|
Inventories.putIntoInventory("LOBBY", 8, Inventories.buildItems(Material.ENDER_PEARL, "inv_lobby_back", ChatColor.YELLOW));
|
||||||
|
|
||||||
Inventories.registerAction("LOBBY", 0, Inventories.Action.COMMAND, "jumpinv");
|
Inventories.registerAction("LOBBY", 0, Inventories.Action.COMMAND, "jumpinv");
|
||||||
Inventories.registerAction("LOBBY", 3, Inventories.Action.TELEPORT, new Location(Bukkit.getWorld("lobby"), -288, 32, -1714));
|
Inventories.registerAction("LOBBY", 1, Inventories.Action.TELEPORT, new Location(Bukkit.getWorld("lobby"), -288, 32, -1714));
|
||||||
|
Inventories.registerAction("LOBBY", 3, Inventories.Action.COMMAND, "toggleminigame xpbattle");
|
||||||
|
Inventories.registerAction("LOBBY", 1, Inventories.Action.COMMAND, "toggleminigame pool");
|
||||||
Inventories.registerAction("LOBBY", 6, Inventories.Action.COMMAND, "spawn");
|
Inventories.registerAction("LOBBY", 6, Inventories.Action.COMMAND, "spawn");
|
||||||
Inventories.registerAction("LOBBY", 8, Inventories.Action.OPEN_INV, "GAMEMODES");
|
Inventories.registerAction("LOBBY", 8, Inventories.Action.OPEN_INV, "GAMEMODES");
|
||||||
|
|
||||||
@@ -328,7 +333,7 @@ public class AnuraCore extends JavaPlugin implements PluginMessageListener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("toggledbljump")) {
|
else if(cmd.getName().equalsIgnoreCase("toggledbljump")) {
|
||||||
if(!(sender instanceof Player)) {
|
if(P == null) {
|
||||||
API.statusMsg(sender, "only_player_cmd", false);
|
API.statusMsg(sender, "only_player_cmd", false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -338,6 +343,77 @@ public class AnuraCore extends JavaPlugin implements PluginMessageListener {
|
|||||||
features.enableFeature(P, Features.Feature.DOUBLE_JUMP);
|
features.enableFeature(P, Features.Feature.DOUBLE_JUMP);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
} else if (cmd.getName().equalsIgnoreCase("joinminigame")) {
|
||||||
|
if (P == null) {
|
||||||
|
API.statusMsg(sender, "only_player_cmd", false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (args.length != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (args[0].equalsIgnoreCase("xpbattle")) {
|
||||||
|
Objective o = Bukkit.getScoreboardManager().getMainScoreboard().getObjective("xpBattleJoin");
|
||||||
|
if (o == null) return true;
|
||||||
|
o.getScore(P).setScore(1);
|
||||||
|
API.statusMsg(sender, "joined_xpBattle", true);
|
||||||
|
return true;
|
||||||
|
} else if (args[0].equalsIgnoreCase("pool")) {
|
||||||
|
Objective o = Bukkit.getScoreboardManager().getMainScoreboard().getObjective("poolJoin");
|
||||||
|
if (o == null) return true;
|
||||||
|
o.getScore(P).setScore(1);
|
||||||
|
API.statusMsg(sender, "joined_pool", true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (cmd.getName().equalsIgnoreCase("leaveminigame")) {
|
||||||
|
if (P == null) {
|
||||||
|
API.statusMsg(sender, "only_player_cmd", false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (args.length != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (args[0].equalsIgnoreCase("xpbattle")) {
|
||||||
|
Objective o = Bukkit.getScoreboardManager().getMainScoreboard().getObjective("xpBattleJoin");
|
||||||
|
if (o == null) return true;
|
||||||
|
o.getScore(P).setScore(0);
|
||||||
|
API.statusMsg(sender, "left_xpBattle", true);
|
||||||
|
return true;
|
||||||
|
} else if (args[0].equalsIgnoreCase("pool")) {
|
||||||
|
Objective o = Bukkit.getScoreboardManager().getMainScoreboard().getObjective("poolJoin");
|
||||||
|
if (o == null) return true;
|
||||||
|
o.getScore(P).setScore(0);
|
||||||
|
API.statusMsg(sender, "left_pool", true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (cmd.getName().equalsIgnoreCase("toggleminigame")) {
|
||||||
|
if (P == null) {
|
||||||
|
API.statusMsg(sender, "only_player_cmd", false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (args.length != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (args[0].equalsIgnoreCase("xpbattle")) {
|
||||||
|
Objective o = Bukkit.getScoreboardManager().getMainScoreboard().getObjective("xpBattleJoin");
|
||||||
|
if (o == null) return true;
|
||||||
|
if (o.getScore(P).getScore() == 0) {
|
||||||
|
Bukkit.dispatchCommand(sender, "joinminigame xpBattle");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
Bukkit.dispatchCommand(sender, "leaveminigame xpBattle");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (args[0].equalsIgnoreCase("pool")) {
|
||||||
|
Objective o = Bukkit.getScoreboardManager().getMainScoreboard().getObjective("poolJoin");
|
||||||
|
if (o == null) return true;
|
||||||
|
if (o.getScore(P).getScore() == 0) {
|
||||||
|
Bukkit.dispatchCommand(sender, "joinminigame pool");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
Bukkit.dispatchCommand(sender, "leaveminigame pool");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("updatecommandblocks"))
|
else if(cmd.getName().equalsIgnoreCase("updatecommandblocks"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -72,4 +72,13 @@ commands:
|
|||||||
usage: /<command> {<x1>, <y1>, <z1>}...
|
usage: /<command> {<x1>, <y1>, <z1>}...
|
||||||
toggledbljump:
|
toggledbljump:
|
||||||
description: Toggles the double jump
|
description: Toggles the double jump
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
joinminigame:
|
||||||
|
description: Join a redstone minigame
|
||||||
|
usage: /<command> (xpBattle|pool)
|
||||||
|
leaveminigame:
|
||||||
|
description: Leave a redstone minigame
|
||||||
|
usage: /<command> (xpBattle|pool)
|
||||||
|
toggleminigame:
|
||||||
|
description: Join/Leave a redstone minigame
|
||||||
|
usage: /<command> (xpBattle|pool)
|
||||||
Reference in New Issue
Block a user