From 7abf31ea821a0bbddb836adb1a63d0fec2ceee4f Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Mon, 25 Apr 2022 18:41:24 +0200 Subject: Initial commit --- .../com/encrox/instancedregions/Commander.java | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 src/main/java/com/encrox/instancedregions/Commander.java (limited to 'src/main/java/com/encrox/instancedregions/Commander.java') diff --git a/src/main/java/com/encrox/instancedregions/Commander.java b/src/main/java/com/encrox/instancedregions/Commander.java new file mode 100755 index 0000000..fa541d6 --- /dev/null +++ b/src/main/java/com/encrox/instancedregions/Commander.java @@ -0,0 +1,48 @@ +package com.encrox.instancedregions; + +import java.util.Iterator; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + +import com.sk89q.worldedit.BlockVector; + +public class Commander implements CommandExecutor { + + private Plugin plugin; + + public Commander(Plugin plugin) { + this.plugin = plugin; + } + + @Override + public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) { + if(arg0 instanceof Player) { + Player player = (Player)arg0; + switch(arg3[0]) { + case "create": + InstancedProtectedCuboidRegion rg = new InstancedProtectedCuboidRegion(plugin, player.getWorld(), "testInstance", new BlockVector(Integer.parseInt(arg3[1]),0,Integer.parseInt(arg3[2])), new BlockVector(Integer.parseInt(arg3[3]),255,Integer.parseInt(arg3[4]))); + rg.addPlayer(player); + InstancedRegions.region.add(rg); + return true; + case "dispose": + Iterator iter = InstancedRegions.region.iterator(); + while(iter.hasNext()) + iter.next().dispose(); + return true; + /*case "test": + InstancedRegions.region.addToChangeWhitelist(new BlockVector(Integer.parseInt(arg3[1]), Integer.parseInt(arg3[2]), Integer.parseInt(arg3[3]))); + player.sendBlockChange(new Location(player.getWorld(), Integer.parseInt(arg3[1]), Integer.parseInt(arg3[2]), Integer.parseInt(arg3[3])), Material.STONE, (byte) 0); + return true;*/ + } + } + return false; + } + +} -- cgit v1.2.1