Finish CommandSelect
Dieser Commit ist enthalten in:
Ursprung
00b350be63
Commit
b23c112a7d
@ -93,6 +93,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
new CommandGUI();
|
new CommandGUI();
|
||||||
new CommandWorldSpawn();
|
new CommandWorldSpawn();
|
||||||
new CommandRegion();
|
new CommandRegion();
|
||||||
|
new CommandSelect();
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
Bukkit.getPluginManager().registerEvents(this, this);
|
||||||
Bukkit.getPluginManager().registerEvents(new RegionListener(), this);
|
Bukkit.getPluginManager().registerEvents(new RegionListener(), this);
|
||||||
|
@ -121,7 +121,7 @@ public class CommandGUI extends SWCommand implements Listener {
|
|||||||
player.performCommand("redstonetester");
|
player.performCommand("redstonetester");
|
||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(40, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", getNoPermsLore(Arrays.asList("§8//§7wand"), player, "§cDu hast keine Worldeditrechte", Permission.worldedit), false, clickType -> {
|
inv.setItem(40, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", getNoPermsLore(Arrays.asList("§8//§7wand"), player, "§cDu hast keine Worldeditrechte", Permission.WORLDEDIT), false, clickType -> {
|
||||||
if (Welt.noPermission(player, Permission.WORLD))
|
if (Welt.noPermission(player, Permission.WORLD))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
@ -77,7 +77,7 @@ public class CommandProtect extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.worldedit)) {
|
if (Welt.noPermission(player, Permission.WORLDEDIT)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Boden schützen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Boden schützen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class CommandRegion extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.worldedit)) {
|
if (Welt.noPermission(player, Permission.WORLDEDIT)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Region verändern");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Region verändern");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class CommandSelect extends SWCommand {
|
public class CommandSelect extends SWCommand {
|
||||||
|
|
||||||
|
|
||||||
public static final WorldEditPlugin WORLDEDIT_PLUGIN = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
|
public static final WorldEditPlugin WORLDEDIT_PLUGIN = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
|
||||||
public static final World BUKKITWORLD = new BukkitWorld(Bukkit.getWorlds().get(0));
|
public static final World BUKKITWORLD = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
|
|
||||||
@ -23,6 +22,11 @@ public class CommandSelect extends SWCommand {
|
|||||||
super("select");
|
super("select");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Register(help = true)
|
||||||
|
public void genericHelp(Player p, String... args) {
|
||||||
|
p.sendMessage("§8/§eselect §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp aus");
|
||||||
|
p.sendMessage("§8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension");
|
||||||
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void baurahmenCommand(Player p, RegionType regionType) {
|
public void baurahmenCommand(Player p, RegionType regionType) {
|
||||||
@ -33,13 +37,13 @@ public class CommandSelect extends SWCommand {
|
|||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
|
|
||||||
if (GlobalRegion.isGlobalRegion(region)) {
|
if (GlobalRegion.isGlobalRegion(region)) {
|
||||||
//TODO
|
p.sendMessage(BauSystem.PREFIX + "§cDie globale Region kannst du nicht auswählen");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (regionType == RegionType.TESTBLOCK) {
|
if (regionType == RegionType.TESTBLOCK) {
|
||||||
if (!region.hasTestblock()) {
|
if (!region.hasTestblock()) {
|
||||||
//TODO motz den user an
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keinen Testblock");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSelection(regionType, RegionExtensionType.NORMAL, region, p);
|
setSelection(regionType, RegionExtensionType.NORMAL, region, p);
|
||||||
@ -48,7 +52,7 @@ public class CommandSelect extends SWCommand {
|
|||||||
|
|
||||||
if (regionType == RegionType.BUILD) {
|
if (regionType == RegionType.BUILD) {
|
||||||
if (!region.hasBuildRegion()) {
|
if (!region.hasBuildRegion()) {
|
||||||
//TODO motz den user an
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keinen BuildArea");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSelection(regionType, RegionExtensionType.NORMAL, region, p);
|
setSelection(regionType, RegionExtensionType.NORMAL, region, p);
|
||||||
@ -67,13 +71,17 @@ public class CommandSelect extends SWCommand {
|
|||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
|
|
||||||
if (GlobalRegion.isGlobalRegion(region)) {
|
if (GlobalRegion.isGlobalRegion(region)) {
|
||||||
//TODO
|
p.sendMessage(BauSystem.PREFIX + "§cDie globale Region kannst du nicht auswählen");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (regionType == RegionType.TESTBLOCK) {
|
if (regionType == RegionType.TESTBLOCK) {
|
||||||
if (!region.hasTestblock() || !region.hasExtensionArea(regionType)) {
|
if (!region.hasTestblock()) {
|
||||||
//TODO motz den user an
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keinen Testblock");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (regionExtensionType == RegionExtensionType.EXTENSION && !region.hasExtensionArea(regionType)) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keine Ausfahrmaße");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSelection(regionType, regionExtensionType, region, p);
|
setSelection(regionType, regionExtensionType, region, p);
|
||||||
@ -81,8 +89,12 @@ public class CommandSelect extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (regionType == RegionType.BUILD) {
|
if (regionType == RegionType.BUILD) {
|
||||||
if (!region.hasBuildRegion() || !region.hasExtensionArea(regionType)) {
|
if (!region.hasBuildRegion()) {
|
||||||
//TODO motz den user an
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keinen BuildArea");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (regionExtensionType == RegionExtensionType.EXTENSION && !region.hasExtensionArea(regionType)) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§cDiese Region hat keine Ausfahrmaße");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSelection(regionType, regionExtensionType, region, p);
|
setSelection(regionType, regionExtensionType, region, p);
|
||||||
@ -95,7 +107,7 @@ public class CommandSelect extends SWCommand {
|
|||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.WORLDEDIT)) {
|
if (Welt.noPermission(player, Permission.WORLDEDIT)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den AutoLader verwenden");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Select verwenden");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -106,5 +118,6 @@ public class CommandSelect extends SWCommand {
|
|||||||
Point maxPoint = region.getMaxPoint(regionType, regionExtensionType);
|
Point maxPoint = region.getMaxPoint(regionType, regionExtensionType);
|
||||||
|
|
||||||
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, minPoint.toBlockVector3(), maxPoint.toBlockVector3()));
|
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, minPoint.toBlockVector3(), maxPoint.toBlockVector3()));
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "WorldEdit auswahl auf von " + minPoint.getX() + ", " + minPoint.getY() + ", " + minPoint.getZ() + " bis " + maxPoint.getX() + ", " + maxPoint.getY() + ", " + maxPoint.getZ() + " gesetzt");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -77,7 +77,7 @@ public class CommandTestblock extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if (Welt.noPermission(player, Permission.worldedit)) {
|
if (Welt.noPermission(player, Permission.WORLDEDIT)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Testblock zurücksetzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Testblock zurücksetzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class RegionListener implements Listener {
|
|||||||
|
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
|
|
||||||
if (Welt.noPermission(p, Permission.worldedit)) {
|
if (Welt.noPermission(p, Permission.WORLDEDIT)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein WorldEdit benutzen");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein WorldEdit benutzen");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class Welt {
|
|||||||
switch (perm) {
|
switch (perm) {
|
||||||
case BUILD:
|
case BUILD:
|
||||||
return !member1.isBuild();
|
return !member1.isBuild();
|
||||||
case worldedit:
|
case WORLDEDIT:
|
||||||
return !member1.isWorldEdit();
|
return !member1.isWorldEdit();
|
||||||
case WORLD:
|
case WORLD:
|
||||||
return !member1.isWorld();
|
return !member1.isWorld();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren