Added the arena commands

This commit is contained in:
Trixkz 2021-11-22 09:20:39 -05:00
parent 093ec17f0c
commit b260d51d09
18 changed files with 827 additions and 32 deletions

View File

@ -23,12 +23,24 @@
</component>
<component name="ChangeListManager">
<list default="true" id="998d5e92-ac1f-4423-8aef-5f389ab213de" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/CreateCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/EnableAndDisableCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/GenerateCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/InfoCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/RemoveCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetACommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetBCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetBuildMaxCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetDeadZoneCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetIconCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetMaxCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetMinCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetTeamAMaxCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetTeamAMinCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetTeamBMaxCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/SetTeamBMinCommand.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/game/GameType.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/game/GameType.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/menus/queue/QueueMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/menus/queue/PlayAGameMenu.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/menusystem/menu/PlayAGameMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/menusystem/menu/PlayAGameMenu.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/ArenaCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena/ArenaCommand.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -61,15 +73,17 @@
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/java" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/commands/arena" />
<property name="settings.editor.selected.configurable" value="MTConfigurable" />
</component>
<component name="RecentsManager">
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="rip.tilly.bedwars.commands.arena" />
<recent name="rip.tilly.bedwars.mongo" />
<recent name="rip.tilly.bedwars.utils" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\logan\Documents\GitHub\BedWars\src\main\java\rip\tilly\bedwars\commands\arena" />
<recent name="C:\Users\logan\Documents\GitHub\BedWars\src\main\java" />
<recent name="C:\Users\logan\Documents\GitHub\BedWars\src\main\java\rip\tilly\bedwars\commands" />
<recent name="C:\Users\Luca\Documents\GitHub\BedWars\src\main\java\rip\tilly\bedwars" />
@ -166,21 +180,25 @@
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="499" y="159" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637505947686" />
<state width="1493" height="204" key="GridCell.Tab.0.bottom" timestamp="1637586640339">
<state width="1493" height="204" key="GridCell.Tab.0.bottom" timestamp="1637589735031">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="204" key="GridCell.Tab.0.bottom/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637586640339" />
<state width="1493" height="204" key="GridCell.Tab.0.center" timestamp="1637586640339">
<state width="1493" height="204" key="GridCell.Tab.0.bottom/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637589735031" />
<state width="1493" height="204" key="GridCell.Tab.0.center" timestamp="1637589735031">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="204" key="GridCell.Tab.0.center/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637586640339" />
<state width="1493" height="204" key="GridCell.Tab.0.left" timestamp="1637586640339">
<state width="1493" height="204" key="GridCell.Tab.0.center/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637589735031" />
<state width="1493" height="204" key="GridCell.Tab.0.left" timestamp="1637589735031">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="204" key="GridCell.Tab.0.left/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637586640339" />
<state width="1493" height="204" key="GridCell.Tab.0.right" timestamp="1637586640339">
<state width="1493" height="204" key="GridCell.Tab.0.left/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637589735031" />
<state width="1493" height="204" key="GridCell.Tab.0.right" timestamp="1637589735031">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="204" key="GridCell.Tab.0.right/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637586640339" />
<state width="1493" height="204" key="GridCell.Tab.0.right/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637589735031" />
<state x="425" y="187" key="run.anything.popup" timestamp="1637587441862">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="425" y="187" key="run.anything.popup/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637587441862" />
</component>
</project>

View File

@ -5,6 +5,8 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.menus.arena.ArenaManagerMenu;
import rip.tilly.bedwars.utils.CC;
public class ArenaCommand implements CommandExecutor {
@ -21,25 +23,122 @@ public class ArenaCommand implements CommandExecutor {
}
if (args.length == 0) {
player.sendMessage(CC.translate("&cUsage:"));
player.sendMessage(CC.translate(" &c/arena"));
player.sendMessage(CC.translate(" &c/arena manage (Opens arena manage menu)"));
player.sendMessage(CC.translate(" &c/arena create <arena>"));
player.sendMessage(CC.translate(" &c/arena icon <arena>"));
player.sendMessage(CC.translate(" &c/arena enable <arena>"));
player.sendMessage(CC.translate(" &c/arena disable <arena>"));
player.sendMessage(CC.translate(" &c/arena a <arena>"));
player.sendMessage(CC.translate(" &c/arena b <arena>"));
player.sendMessage(CC.translate(" &c/arena min <arena>"));
player.sendMessage(CC.translate(" &c/arena max <arena>"));
player.sendMessage(CC.translate(" &c/arena teamAmin <arena>"));
player.sendMessage(CC.translate(" &c/arena teamAmax <arena>"));
player.sendMessage(CC.translate(" &c/arena teamBmin <arena>"));
player.sendMessage(CC.translate(" &c/arena teamBmax <arena>"));
player.sendMessage(CC.translate(" &c/arena deadzone <arena>"));
player.sendMessage(CC.translate(" &c/arena buildmax <arena>"));
player.sendMessage(CC.translate(CC.chatBar));
player.sendMessage(CC.translate("&dArena Commands"));
player.sendMessage(CC.translate(CC.chatBar));
player.sendMessage(CC.translate("&7⚫ &9/arena &7- &eArena help information"));
player.sendMessage(CC.translate("&7⚫ &9/arena create <arena> &7- &eCreate an arena"));
player.sendMessage(CC.translate("&7⚫ &9/arena remove <arena> &7- &eRemove an arena"));
player.sendMessage(CC.translate("&7⚫ &9/arena enable <arena> &7- &eEnable an arena"));
player.sendMessage(CC.translate("&7⚫ &9/arena disable <arena> &7- &eDisable an arena"));
player.sendMessage(CC.translate("&7⚫ &9/arena info <arena> &7- &eLook at an arena's information"));
player.sendMessage(CC.translate("&7⚫ &9/arena setIcon <arena> &7- &eSet an arena's icon"));
player.sendMessage(CC.translate("&7⚫ &9/arena setA <arena> &7- &eSet A"));
player.sendMessage(CC.translate("&7⚫ &9/arena setB <arena> &7- &eSet B"));
player.sendMessage(CC.translate("&7⚫ &9/arena setMin <arena> &7- &eSet min"));
player.sendMessage(CC.translate("&7⚫ &9/arena setMax <arena> &7- &eSet max"));
player.sendMessage(CC.translate("&7⚫ &9/arena setTeamAMin <arena> &7- &eSet team A min"));
player.sendMessage(CC.translate("&7⚫ &9/arena setTeamAMax <arena> &7- &eSet team A max"));
player.sendMessage(CC.translate("&7⚫ &9/arena setTeamBMin <arena> &7- &eSet team B min"));
player.sendMessage(CC.translate("&7⚫ &9/arena setTeamBMax <arena> &7- &eSet team B max"));
player.sendMessage(CC.translate("&7⚫ &9/arena setDeadZone <arena> <amount> &7- &eSet the dead zone"));
player.sendMessage(CC.translate("&7⚫ &9/arena setBuildMax <arena> <amount> &7- &eSet the build max"));
player.sendMessage(CC.translate("&7⚫ &9/arena list &7- &eLook at all of the arenas"));
player.sendMessage(CC.translate("&7⚫ &9/arena save &7- &eSave all of the arenas"));
player.sendMessage(CC.translate("&7⚫ &9/arena manage &7- &eOpen the arena manage menu"));
player.sendMessage(CC.translate("&7⚫ &9/arena generate <arena> <amount> &7- &eGenerate the specified amount for the specified arena"));
player.sendMessage(CC.translate(CC.chatBar));
} else {
switch (args[0]) {
switch (args[0].toLowerCase()) {
case "create":
new CreateCommand().executeAs(sender, cmd, label, args);
break;
case "remove":
new RemoveCommand().executeAs(sender, cmd, label, args);
break;
case "enable":
case "disable":
new EnableAndDisableCommand().executeAs(sender, cmd, label, args);
break;
case "info":
new InfoCommand().executeAs(sender, cmd, label, args);
break;
case "seticon":
new SetIconCommand().executeAs(sender, cmd, label, args);
break;
case "seta":
new SetACommand().executeAs(sender, cmd, label, args);
break;
case "setb":
new SetBCommand().executeAs(sender, cmd, label, args);
break;
case "setmin":
new SetMinCommand().executeAs(sender, cmd, label, args);
break;
case "setmax":
new SetMaxCommand().executeAs(sender, cmd, label, args);
break;
case "setteamamin":
new SetTeamAMinCommand().executeAs(sender, cmd, label, args);
break;
case "setteamamax":
new SetTeamAMaxCommand().executeAs(sender, cmd, label, args);
break;
case "setteambmin":
new SetTeamBMinCommand().executeAs(sender, cmd, label, args);
break;
case "setteambmax":
new SetTeamBMaxCommand().executeAs(sender, cmd, label, args);
break;
case "setdeadzone":
new SetDeadZoneCommand().executeAs(sender, cmd, label, args);
break;
case "setbuildmax":
new SetBuildMaxCommand().executeAs(sender, cmd, label, args);
break;
case "list":
player.sendMessage(CC.translate("&b&lArenas List &7(&3Total: " + this.main.getArenaManager().getArenas().size() + "&7)"));
for (Arena arena : this.main.getArenaManager().getArenas().values()) {
player.sendMessage(CC.translate(" &7▸ &b" + arena.getName() + " &7(" + (arena.isEnabled() ? "&aEnabled" : "&cDisabled") + "&7)"));
}
break;
case "save":
this.main.getArenaManager().reloadArenas();
player.sendMessage(CC.translate("&aSuccessfully saved all of the arenas"));
break;
case "manage":
if (this.main.getArenaManager().getArenas().size() == 0) {
player.sendMessage(CC.translate("&cError: There are no arenas"));
return true;
}
new ArenaManagerMenu().openMenu(player);
break;
case "generate":
new GenerateCommand().executeAs(sender, cmd, label, args);
break;
}
}

View File

@ -0,0 +1,39 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import java.util.ArrayList;
import java.util.List;
public class CreateCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena == null) {
this.main.getArenaManager().createArena(args[1]);
player.sendMessage(CC.translate("&aSuccessfully created the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena already exists"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,39 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import java.util.ArrayList;
import java.util.List;
public class EnableAndDisableCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
arena.setEnabled(!arena.isEnabled());
player.sendMessage(arena.isEnabled() ? CC.translate("&aSuccessfully enabled the arena called &a&l" + args[1]) : CC.translate("&cSuccessfully disabled the arena called &c&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,41 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.runnables.ArenaCommandRunnable;
import rip.tilly.bedwars.utils.CC;
import java.util.ArrayList;
import java.util.List;
public class GenerateCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (args.length == 3) {
int arenas = Integer.parseInt(args[2]);
this.main.getServer().getScheduler().runTask(this.main, new ArenaCommandRunnable(this.main, arena, arenas));
this.main.getArenaManager().setGeneratingArenaRunnable(this.main.getArenaManager().getGeneratingArenaRunnable() + 1);
} else {
player.sendMessage(CC.translate("&cUsage: /arena generate <name> <copies>"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,45 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import java.util.ArrayList;
import java.util.List;
public class InfoCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
player.sendMessage(CC.translate("&b&lArena Information"));
player.sendMessage(CC.translate(""));
player.sendMessage(CC.translate(" &7▸ &bName: &3" + arena.getName()));
player.sendMessage(CC.translate(" &7▸ &bState: " + (arena.isEnabled() ? "&aEnabled" : "&cDisabled")));
player.sendMessage(CC.translate(" &7▸ &b1st Spawn: &3" + Math.round(arena.getA().getX()) + "&7, &b" + Math.round(arena.getA().getY()) + "&7, &b" + Math.round(arena.getA().getZ())));
player.sendMessage(CC.translate(" &7▸ &b2nd Spawn: &3" + Math.round(arena.getB().getX()) + "&7, &b" + Math.round(arena.getB().getY()) + "&7, &b" + Math.round(arena.getB().getZ())));
player.sendMessage(CC.translate(" &7▸ &bMin Location: &3" + Math.round(arena.getMin().getX()) + "&7, &b" + Math.round(arena.getMin().getY()) + "&7, &b" + Math.round(arena.getMin().getZ())));
player.sendMessage(CC.translate(" &7▸ &bMax Location: &3" + Math.round(arena.getMax().getX()) + "&7, &b" + Math.round(arena.getMax().getY()) + "&7, &b" + Math.round(arena.getMax().getZ())));
player.sendMessage(CC.translate(" &7▸ &bAvailable Arenas: &3" + (arena.getAvailableArenas().size() == 0 ? +1 : arena.getAvailableArenas().size())));
} else {
player.sendMessage(CC.translate("&cThis arena does not exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,39 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import java.util.ArrayList;
import java.util.List;
public class RemoveCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
this.main.getArenaManager().deleteArena(args[1]);
player.sendMessage(CC.translate("&aSuccessfully deleted the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,43 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList;
import java.util.List;
public class SetACommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
Location location = player.getLocation();
arena.setA(CustomLocation.fromBukkitLocation(location));
player.sendMessage(CC.translate("&aSuccessfully set the A position for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,43 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList;
import java.util.List;
public class SetBCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
Location location = player.getLocation();
arena.setB(CustomLocation.fromBukkitLocation(location));
player.sendMessage(CC.translate("&aSuccessfully set the B position for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,41 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import java.util.ArrayList;
import java.util.List;
public class SetBuildMaxCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
int amount = Integer.parseInt(args[2]);
arena.setBuildMax(amount);
player.sendMessage(CC.translate("&aSuccessfully set the build maximum for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,41 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import java.util.ArrayList;
import java.util.List;
public class SetDeadZoneCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
int amount = Integer.parseInt(args[2]);
arena.setDeadZone(amount);
player.sendMessage(CC.translate("&aSuccessfully set the dead zone for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,49 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import java.util.ArrayList;
import java.util.List;
public class SetIconCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
if (player.getItemInHand().getType() != Material.AIR) {
String icon = player.getItemInHand().getType().name();
int iconData = player.getItemInHand().getDurability();
arena.setIcon(icon);
arena.setIconData(iconData);
player.sendMessage(CC.translate("&aSuccessfully set the icon for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cYou must be holding an item to set the arena icon"));
}
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,43 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList;
import java.util.List;
public class SetMaxCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
Location location = player.getLocation();
arena.setMax(CustomLocation.fromBukkitLocation(location));
player.sendMessage(CC.translate("&aSuccessfully set the maximum position for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,43 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList;
import java.util.List;
public class SetMinCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
Location location = player.getLocation();
arena.setMin(CustomLocation.fromBukkitLocation(location));
player.sendMessage(CC.translate("&aSuccessfully set the minimum position for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,43 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList;
import java.util.List;
public class SetTeamAMaxCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
Location location = player.getLocation();
arena.setTeamAmax(CustomLocation.fromBukkitLocation(location));
player.sendMessage(CC.translate("&aSuccessfully set the Team A maximum position for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,43 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList;
import java.util.List;
public class SetTeamAMinCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
Location location = player.getLocation();
arena.setTeamAmin(CustomLocation.fromBukkitLocation(location));
player.sendMessage(CC.translate("&aSuccessfully set the Team A minimum position for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,43 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList;
import java.util.List;
public class SetTeamBMaxCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
Location location = player.getLocation();
arena.setTeamBmax(CustomLocation.fromBukkitLocation(location));
player.sendMessage(CC.translate("&aSuccessfully set the Team B maximum position for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -0,0 +1,43 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList;
import java.util.List;
public class SetTeamBMinCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
Location location = player.getLocation();
arena.setTeamBmin(CustomLocation.fromBukkitLocation(location));
player.sendMessage(CC.translate("&aSuccessfully set the Team B minimum position for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}