SteamWar/BauSystem
Archiviert
13
0

Merge branch 'master' into RegionFix

# Conflicts:
#	BauSystem_Main/src/de/steamwar/bausystem/Permission.java
#	BauSystem_Main/src/de/steamwar/bausystem/commands/CommandDebugStick.java
#	BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java
#	BauSystem_Main/src/de/steamwar/bausystem/commands/CommandLoader.java
#	BauSystem_Main/src/de/steamwar/bausystem/commands/CommandRedstoneTester.java
#	BauSystem_Main/src/de/steamwar/bausystem/world/RedstoneListener.java
#	BauSystem_Main/src/de/steamwar/bausystem/world/RegionListener.java
#	BauSystem_Main/src/de/steamwar/bausystem/world/Welt.java
Dieser Commit ist enthalten in:
yoyosource 2021-04-04 18:55:29 +02:00
Commit dc4bbf3faa
19 geänderte Dateien mit 125 neuen und 210 gelöschten Zeilen

Datei anzeigen

@ -29,6 +29,9 @@ import java.util.List;
public class SWUtils {
public static void giveItemToPlayer(Player player, ItemStack itemStack) {
if (itemStack == null || itemStack.getType() == Material.AIR) {
return;
}
for (int i = 0; i < player.getInventory().getSize(); i++) {
ItemStack current = player.getInventory().getItem(i);
if (current != null && current.isSimilar(itemStack)) {

Datei anzeigen

@ -103,6 +103,7 @@ public class BauSystem extends JavaPlugin implements Listener {
Bukkit.getPluginManager().registerEvents(new TNTSimulatorListener(), this);
Bukkit.getPluginManager().registerEvents(new CommandGUI(), this);
Bukkit.getPluginManager().registerEvents(new DetonatorListener(), this);
Bukkit.getPluginManager().registerEvents(new ItemFrameListener(), this);
VersionedRunnable.call(new VersionedRunnable(() -> Bukkit.getPluginManager().registerEvents(new RedstoneListener(), this), 15));
new AFKStopper();

Datei anzeigen

@ -20,8 +20,7 @@
package de.steamwar.bausystem;
public enum Permission {
WORLD,
WORLDEDIT,
BUILD,
MEMBER
world,
worldedit,
member
}

Datei anzeigen

@ -38,7 +38,6 @@ public class CommandBau extends SWCommand {
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage("§8/§ebau togglebuild §8[§7Player§8] §8- §7Editiere die Bau Rechte eines Spielers");
p.sendMessage("§8/§ebau togglewe §8[§7Player§8] §8- §7Editiere die WorldEdit Rechte eines Spielers");
p.sendMessage("§8/§ebau toggleworld §8[§7Player§8] §8- §7Editiere die Werlt Rechte eines Spielers");
}
@ -48,14 +47,6 @@ public class CommandBau extends SWCommand {
CommandInfo.sendBauInfo(p);
}
@Register("togglebuild")
public void toggleBuildCommand(Player p, SteamwarUser user) {
if (!permissionCheck(p)) {
return;
}
onToggleBD(p, user);
}
@Register("togglewe")
public void toggleWECommand(Player p, SteamwarUser user) {
if (!permissionCheck(p)) {
@ -72,16 +63,6 @@ public class CommandBau extends SWCommand {
onToggleWorld(p, user);
}
private void onToggleBD(Player p, SteamwarUser id) {
if (negativeToggleCheck(p, id)) {
return;
}
BauweltMember target = BauweltMember.getBauMember(BauSystem.getOwnerID(), id.getId());
Welt.toggleBuild(p, target);
}
private void onToggleWE(Player p, SteamwarUser id) {
if (negativeToggleCheck(p, id)) {
return;

Datei anzeigen

@ -20,8 +20,6 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.world.Welt;
import de.steamwar.command.SWCommand;
import de.steamwar.core.VersionedRunnable;
import org.bukkit.entity.Player;
@ -39,11 +37,7 @@ public class CommandDebugStick extends SWCommand {
@Register
public void genericCommand(Player p) {
if (Welt.noPermission(p, Permission.BUILD)) {
p.sendMessage(BauSystem.PREFIX + "§cKein Debugstick für dich hier.");
} else {
VersionedRunnable.call(new VersionedRunnable(() -> p.sendMessage(BauSystem.PREFIX + "§cDen Debugstick gibt es nicht in der 1.12."), 8),
new VersionedRunnable(() -> CommandDebugStick_15.giveStick(p), 15));
}
}
}

Datei anzeigen

@ -25,8 +25,6 @@ import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
import de.steamwar.bausystem.tracer.show.TraceShowManager;
import de.steamwar.bausystem.world.*;
import de.steamwar.bausystem.world.regions.GlobalRegion;
import de.steamwar.bausystem.world.regions.Region;
import de.steamwar.command.SWCommand;
import de.steamwar.core.Core;
import de.steamwar.inventory.SWAnvilInv;
@ -97,45 +95,43 @@ public class CommandGUI extends SWCommand implements Listener {
player.performCommand("gui item");
});
ItemStack dtWand = wand(player, Detonator.WAND, "§8/§7dt wand", Permission.WORLD, "§cDu hast keine Worldrechte");
ItemStack dtWand = wand(player, Detonator.WAND, "§8/§7dt wand", Permission.world, "§cDu hast keine Worldrechte");
inv.setItem(39, dtWand, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
if (Welt.noPermission(player, Permission.world))
return;
player.closeInventory();
player.performCommand("dt wand");
});
ItemStack simWand = wand(player, TNTSimulator.WAND, "§8/§7sim wand", Permission.WORLD, "§cDu hast keine Worldrechte");
ItemStack simWand = wand(player, TNTSimulator.WAND, "§8/§7sim wand", Permission.world, "§cDu hast keine Worldrechte");
inv.setItem(38, simWand, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
if (Welt.noPermission(player, Permission.world))
return;
player.closeInventory();
player.performCommand("sim wand");
});
ItemStack redstoneWand = wand(player, RedstoneListener.WAND, "§8/§7redstonetester", Permission.BUILD, "Du hast keine Buildrechte");
ItemStack redstoneWand = wand(player, RedstoneListener.WAND, "§8/§7redstonetester", null, "");
inv.setItem(37, redstoneWand, clickType -> {
if (Welt.noPermission(player, Permission.BUILD))
return;
player.closeInventory();
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 -> {
if (Welt.noPermission(player, Permission.WORLD))
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))
return;
player.closeInventory();
player.performCommand("/wand");
});
inv.setItem(41, getMaterial("DEBUG_STICK", "STICK"), "§eDebugstick", getNoPermsLore(Arrays.asList("§8/§7debugstick"), player, "§cDu hast keine Worldrechte", Permission.WORLD), Core.getVersion() < 13, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(41, getMaterial("DEBUG_STICK", "STICK"), "§eDebugstick", getNoPermsLore(Arrays.asList("§8/§7debugstick"), player, "§cDu hast keine Worldrechte", Permission.world), Core.getVersion() < 13, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
player.closeInventory();
player.performCommand("debugstick");
});
inv.setItem(20, Material.COMPASS, "§7TPS Limitieren", getNoPermsLore(Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e0,5 - " + (TPSUtils.isWarpAllowed() ? 40 : 20) + "§8]"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(20, Material.COMPASS, "§7TPS Limitieren", getNoPermsLore(Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e0,5 - " + (TPSUtils.isWarpAllowed() ? 40 : 20) + "§8]"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
SWAnvilInv anvilInv = new SWAnvilInv(player, "TPS Limitieren");
anvilInv.setItem(Material.COMPASS);
@ -170,16 +166,16 @@ public class CommandGUI extends SWCommand implements Listener {
scriptBooksGUI(player);
});
inv.setItem(21, Material.OBSERVER, "§7Tracer", getNoPermsLore(Arrays.asList("§7Status: §e" + RecordStateMachine.getRecordStatus().getName()), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(21, Material.OBSERVER, "§7Tracer", getNoPermsLore(Arrays.asList("§7Status: §e" + RecordStateMachine.getRecordStatus().getName()), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
player.closeInventory();
OPEN_TRACER_INVS.add(player);
traceGUI(player);
});
inv.setItem(22, Material.DISPENSER, "§7Auto-Loader", getNoPermsLore(Arrays.asList("§7Status: " + (AutoLoader.hasLoader(player) ? "§aan" : "§caus")), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(22, Material.DISPENSER, "§7Auto-Loader", getNoPermsLore(Arrays.asList("§7Status: " + (AutoLoader.hasLoader(player) ? "§aan" : "§caus")), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
player.closeInventory();
autoLoaderGUI(player);
@ -192,7 +188,7 @@ public class CommandGUI extends SWCommand implements Listener {
anvilInv.open();
});
if (GlobalRegion.isGlobalRegion(region)) {
if (Region.GlobalRegion.isGlobalRegion(region)) {
inv.setItem(9, Material.BARRIER, "§eKeine Region", clickType -> {
});
inv.setItem(18, Material.BARRIER, "§eKeine Region", clickType -> {
@ -200,15 +196,15 @@ public class CommandGUI extends SWCommand implements Listener {
inv.setItem(27, Material.BARRIER, "§eKeine Region", clickType -> {
});
} else {
inv.setItem(27, getMaterial("HEAVY_WEIGHTED_PRESSURE_PLATE", "IRON_PLATE"), "§eRegion Reseten", getNoPermsLore(Arrays.asList("§8/§7reset"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(27, getMaterial("HEAVY_WEIGHTED_PRESSURE_PLATE", "IRON_PLATE"), "§eRegion Reseten", getNoPermsLore(Arrays.asList("§8/§7reset"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
confirmationInventory(player, "Region Reseten?", () -> player.performCommand("reset"), () -> openBauGui(player));
});
if (region.hasProtection()) {
inv.setItem(18, Material.OBSIDIAN, "§eRegion Protecten", getNoPermsLore(Arrays.asList("§8/§7protect"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(18, Material.OBSIDIAN, "§eRegion Protecten", getNoPermsLore(Arrays.asList("§8/§7protect"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player));
});
@ -218,8 +214,8 @@ public class CommandGUI extends SWCommand implements Listener {
}
if (region.hasTestblock()) {
inv.setItem(9, getMaterial("END_STONE", "ENDER_STONE"), "§eTestblock erneuern", getNoPermsLore(Arrays.asList("§8/§7testblock"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(9, getMaterial("END_STONE", "ENDER_STONE"), "§eTestblock erneuern", getNoPermsLore(Arrays.asList("§8/§7testblock"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player));
});
@ -254,11 +250,11 @@ public class CommandGUI extends SWCommand implements Listener {
}
boolean isBuildArea = region.hasBuildRegion();
List<String> tntLore = getNoPermsLore(Arrays.asList("§8/§7tnt §8[" + (isBuildArea ? "§eTB§7, " : "") + "§eOff §7oder §eOn§7]"), player, "§cDu hast keine Worldrechte", Permission.WORLD);
List<String> tntLore = getNoPermsLore(Arrays.asList("§8/§7tnt §8[" + (isBuildArea ? "§eTB§7, " : "") + "§eOff §7oder §eOn§7]"), player, "§cDu hast keine Worldrechte", Permission.world);
switch (region.getTntMode()) {
case OFF:
inv.setItem(23, Material.MINECART, "§7TNT: §eAusgeschaltet", tntLore, false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
if (Welt.noPermission(player, Permission.world))
return;
player.performCommand("tnt " + (isBuildArea ? "tb" : "on"));
updateInventories();
@ -266,7 +262,7 @@ public class CommandGUI extends SWCommand implements Listener {
break;
case ONLY_TB:
inv.setItem(23, getMaterial("TNT_MINECART", "EXPLOSIVE_MINECART"), "§7TNT: §enur Testblock", tntLore, false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
if (Welt.noPermission(player, Permission.world))
return;
player.performCommand("tnt on");
updateInventories();
@ -274,7 +270,7 @@ public class CommandGUI extends SWCommand implements Listener {
break;
default:
inv.setItem(23, Material.TNT, "§7TNT: §eEingeschaltet", tntLore, false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
if (Welt.noPermission(player, Permission.world))
return;
player.performCommand("tnt off");
updateInventories();
@ -282,15 +278,15 @@ public class CommandGUI extends SWCommand implements Listener {
}
if (region.isFreeze()) {
inv.setItem(24, getMaterial("GUNPOWDER", "SULPHUR"), "§7Freeze: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(24, getMaterial("GUNPOWDER", "SULPHUR"), "§7Freeze: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
player.performCommand("freeze");
updateInventories();
});
} else {
inv.setItem(24, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(24, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
player.performCommand("freeze");
updateInventories();
@ -298,24 +294,22 @@ public class CommandGUI extends SWCommand implements Listener {
}
if (region.isFire()) {
inv.setItem(3, getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE"), "§7Fire: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(3, getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE"), "§7Fire: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
player.performCommand("fire");
updateInventories();
});
} else {
inv.setItem(3, getMaterial("FIRE_CHARGE", "FIREBALL"), "§7Fire: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.WORLD), false, clickType -> {
if (Welt.noPermission(player, Permission.WORLD))
inv.setItem(3, getMaterial("FIRE_CHARGE", "FIREBALL"), "§7Fire: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
if (Welt.noPermission(player, Permission.world))
return;
player.performCommand("fire");
updateInventories();
});
}
inv.setItem(2, Material.ENDER_PEARL, "§7Teleporter", getNoPermsLore(Arrays.asList("§8/§7tp §8[§eSpieler§8]"), player, "§cDu hast keine Buildrechte", Permission.BUILD), false, clickType -> {
if (Welt.noPermission(player, Permission.BUILD))
return;
inv.setItem(2, Material.ENDER_PEARL, "§7Teleporter", getNoPermsLore(Arrays.asList("§8/§7tp §8[§eSpieler§8]"), player, "", null), false, clickType -> {
List<SWListInv.SWListEntry<String>> playerSWListEntry = new ArrayList<>();
Bukkit.getOnlinePlayers().forEach(player1 -> {
if (player1.equals(player))
@ -481,7 +475,6 @@ public class CommandGUI extends SWCommand implements Listener {
item.setName("§7" + user.getUserName());
List<String> lore = new ArrayList<>();
lore.add("§7Online: §e" + (Bukkit.getPlayer(user.getUUID()) == null ? "Offline" : "Online"));
lore.add("§7Bauen: §e" + (member.isBuild() ? "Ja" : "Nein"));
lore.add("§7Worldedit: §e" + (member.isWorldEdit() ? "Ja" : "Nein"));
lore.add("§7World: §e" + (member.isWorld() ? "Ja" : "Nein"));
item.setLore(lore);
@ -516,47 +509,35 @@ public class CommandGUI extends SWCommand implements Listener {
private static void bauweltMemberGUI(Player player, BauweltMember member) {
SteamwarUser user = SteamwarUser.get(member.getMemberID());
SWInventory inv = new SWInventory(player, 9, "Member: " + user.getUserName());
if (member.isBuild()) {
inv.setItem(0, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7Bauen", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau togglebuild §8[§eSpieler§8]"), false, clickType -> {
member.setBuild(false);
bauweltMemberGUI(player, member);
});
} else {
inv.setItem(0, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7Bauen", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau togglebuild §8[§eSpieler§8]"), false, clickType -> {
member.setBuild(true);
bauweltMemberGUI(player, member);
});
}
if (member.isWorldEdit()) {
inv.setItem(2, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7Worldedit", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau togglewe §8[§eSpieler§8]"), false, clickType -> {
inv.setItem(1, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7Worldedit", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau togglewe §8[§eSpieler§8]"), false, clickType -> {
member.setWorldEdit(false);
bauweltMemberGUI(player, member);
});
} else {
inv.setItem(2, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7Worldedit", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau togglewe §8[§eSpieler§8]"), false, clickType -> {
inv.setItem(1, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7Worldedit", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau togglewe §8[§eSpieler§8]"), false, clickType -> {
member.setWorldEdit(true);
bauweltMemberGUI(player, member);
});
}
if (member.isWorld()) {
inv.setItem(4, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7World", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau toggleworld §8[§eSpieler§8]"), false, clickType -> {
inv.setItem(3, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7World", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau toggleworld §8[§eSpieler§8]"), false, clickType -> {
member.setWorld(false);
bauweltMemberGUI(player, member);
});
} else {
inv.setItem(4, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7World", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau toggleworld §8[§eSpieler§8]"), false, clickType -> {
inv.setItem(3, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7World", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau toggleworld §8[§eSpieler§8]"), false, clickType -> {
member.setWorld(true);
bauweltMemberGUI(player, member);
});
}
inv.setItem(6, Material.BARRIER, "§7Member entfernen", clickType -> {
inv.setItem(5, Material.BARRIER, "§7Member entfernen", clickType -> {
player.closeInventory();
confirmChatMessage(player, "/bau delmember " + user.getUserName());
});
inv.setItem(8, Material.ARROW, "§7Zurück", clickType -> bauManagementGUI(player));
inv.setItem(7, Material.ARROW, "§7Zurück", clickType -> bauManagementGUI(player));
inv.open();
}
@ -571,7 +552,7 @@ public class CommandGUI extends SWCommand implements Listener {
}
private static List<String> getNoPermsLore(List<String> lore, Player player, String noPerms, Permission perm) {
if (Welt.noPermission(player, perm)) {
if (perm != null && Welt.noPermission(player, perm)) {
lore = new ArrayList<>(lore);
lore.add(noPerms);
}

Datei anzeigen

@ -19,9 +19,7 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.command.SWCommand;
import de.steamwar.sql.BauweltMember;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
@ -38,7 +36,6 @@ public class CommandGamemode extends SWCommand {
@Register
public void genericCommand(Player p) {
if (!permissionCheck(p)) return;
if (p.getGameMode() == GameMode.CREATIVE) {
p.setGameMode(GameMode.SPECTATOR);
} else {
@ -48,18 +45,6 @@ public class CommandGamemode extends SWCommand {
@Register
public void gamemodeCommand(Player p, GameMode gameMode) {
if (!permissionCheck(p)) return;
p.setGameMode(gameMode);
}
private boolean permissionCheck(Player p) {
if (!p.getUniqueId().equals(BauSystem.getOwner())) {
BauweltMember member = BauweltMember.getBauMember(BauSystem.getOwner(), p.getUniqueId());
if (member == null || !member.isBuild()) {
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier deinen Spielmodus nicht ändern");
return false;
}
}
return true;
}
}

Datei anzeigen

@ -58,7 +58,6 @@ public class CommandInfo extends SWCommand {
for (BauweltMember member : members) {
membermessage.append("§e").append(SteamwarUser.get(member.getMemberID()).getUserName()).append("§8[");
membermessage.append(member.isBuild() ? "§a" : "§c").append("B").append("§8,");
membermessage.append(member.isWorldEdit() ? "§a" : "§c").append("WE").append("§8,");
membermessage.append(member.isWorld() ? "§a" : "§c").append("W").append("§8]").append(" ");
}

Datei anzeigen

@ -45,48 +45,34 @@ public class CommandLoader extends SWCommand {
@Register({"setup"})
public void setupCommand(Player p) {
if (!permissionCheck(p)) return;
setup(p);
}
@Register({"undo"})
public void undoCommand(Player p) {
if (!permissionCheck(p)) return;
undo(p);
}
@Register({"start"})
public void startCommand(Player p) {
if (!permissionCheck(p)) return;
start(p);
}
@Register({"stop"})
public void stopCommand(Player p) {
if (!permissionCheck(p)) return;
stop(p);
}
@Register({"wait"})
public void waitCommand(Player p, int time) {
if (!permissionCheck(p)) return;
wait(p, time);
}
@Register({"speed"})
public void speedCommand(Player p, int time) {
if (!permissionCheck(p)) return;
speed(p, time);
}
private boolean permissionCheck(Player player) {
if (Welt.noPermission(player, Permission.BUILD)) {
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den AutoLader verwenden");
return false;
}
return true;
}
private void setup(Player player) {
AutoLoader.getLoader(player).setup();
}

Datei anzeigen

@ -44,19 +44,10 @@ public class CommandRedstoneTester extends SWCommand {
VersionedRunnable.call(new VersionedRunnable(() -> {
p.sendMessage(BauSystem.PREFIX + "Der RedstoneTester ist nicht in der 1.12 verfügbar");
}, 8), new VersionedRunnable(() -> {
if (!permissionCheck(p)) return;
p.sendMessage(BauSystem.PREFIX + "Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten");
SWUtils.giveItemToPlayer(p, RedstoneListener.WAND);
}, 15));
}
private boolean permissionCheck(Player player) {
if (Welt.noPermission(player, Permission.BUILD)) {
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Redstonetester nutzen");
return false;
}
return true;
}
}

Datei anzeigen

@ -63,7 +63,9 @@ public class CommandTPSLimiter extends SWCommand {
public CommandTPSLimiter() {
super("tpslimit");
if (TPSUtils.isWarpAllowed()) {
tabCompletions.addAll(Arrays.asList("21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40"));
for (int i = 20; i <= 60; i += 5) {
tabCompletions.add(i + "");
}
}
}
@ -84,7 +86,7 @@ public class CommandTPSLimiter extends SWCommand {
@Register
public void valueCommand(Player p, double tpsLimitDouble) {
if (!permissionCheck(p)) return;
if (tpsLimitDouble < 0.5 || tpsLimitDouble > (TPSUtils.isWarpAllowed() ? 40 : 20)) {
if (tpsLimitDouble < 0.5 || tpsLimitDouble > (TPSUtils.isWarpAllowed() ? 60 : 20)) {
sendInvalidArgumentMessage(p);
return;
}
@ -117,7 +119,7 @@ public class CommandTPSLimiter extends SWCommand {
}
private void sendInvalidArgumentMessage(Player player) {
player.sendMessage(BauSystem.PREFIX + "§cNur Zahlen zwischen 0,5 und " + (TPSUtils.isWarpAllowed() ? 40 : 20) + ", und 'default' erlaubt.");
player.sendMessage(BauSystem.PREFIX + "§cNur Zahlen zwischen 0,5 und " + (TPSUtils.isWarpAllowed() ? 60 : 20) + ", und 'default' erlaubt.");
}
private void tpsLimiter() {
@ -166,7 +168,7 @@ public class CommandTPSLimiter extends SWCommand {
public static void setTPS(double d) {
if (d < 0.5) d = 0.5;
if (d > (TPSUtils.isWarpAllowed() ? 40 : 20)) d = (TPSUtils.isWarpAllowed() ? 40 : 20);
if (d > (TPSUtils.isWarpAllowed() ? 60 : 20)) d = (TPSUtils.isWarpAllowed() ? 60 : 20);
if (instance != null) {
currentTPSLimit = d;
instance.tpsLimiter();

Datei anzeigen

@ -21,7 +21,6 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.command.SWCommand;
import de.steamwar.sql.BauweltMember;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
@ -42,15 +41,6 @@ public class CommandTeleport extends SWCommand {
p.sendMessage(BauSystem.PREFIX + "§cSei eins mit dir selbst!");
return;
}
if (!BauSystem.getOwner().equals(p.getUniqueId())) {
BauweltMember member = BauweltMember.getBauMember(BauSystem.getOwner(), p.getUniqueId());
if (member == null || !member.isBuild()) {
p.sendMessage(BauSystem.PREFIX + "§cDu darfst dich auf dieser Welt nicht teleportieren!");
return;
}
}
p.teleport(target, PlayerTeleportEvent.TeleportCause.COMMAND);
}
}

Datei anzeigen

@ -0,0 +1,52 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.world;
import de.steamwar.bausystem.SWUtils;
import org.bukkit.Material;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack;
public class ItemFrameListener implements Listener {
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (!(event.getDamager() instanceof Player)) {
return;
}
if (!(event.getEntity() instanceof ItemFrame)) {
return;
}
event.setCancelled(true);
ItemFrame itemFrame = (ItemFrame) event.getEntity();
ItemStack itemStack = itemFrame.getItem();
if (itemStack.getType() != Material.AIR) {
SWUtils.giveItemToPlayer((Player) event.getDamager(), itemFrame.getItem());
itemFrame.setItem(null);
} else {
itemFrame.remove();
}
}
}

Datei anzeigen

@ -48,14 +48,6 @@ public class RedstoneListener implements Listener {
public static final ItemStack WAND = new SWItem(Material.BLAZE_ROD, "§eRedstonetester", Arrays.asList("§eLinksklick Block §8- §7Setzt die 1. Position", "§eRechtsklick Block §8- §7Setzt die 2. Position", "§eShift-Rechtsklick Luft §8- §7Zurücksetzten"), false, null).getItemStack();
private static Map<Player, RedstoneTester> playerMap = new HashMap<>();
private boolean permissionCheck(Player player) {
if (Welt.noPermission(player, Permission.BUILD)) {
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Redstonetester nutzen");
return false;
}
return true;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!WAND.isSimilar(event.getItem())) return;
@ -63,10 +55,6 @@ public class RedstoneListener implements Listener {
Block block = event.getClickedBlock();
event.setCancelled(true);
if (!permissionCheck(event.getPlayer())) {
return;
}
switch (event.getAction()) {
case RIGHT_CLICK_AIR:
if (player.isSneaking()) {

Datei anzeigen

@ -53,52 +53,12 @@ public class RegionListener implements Listener {
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");
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockBreak(BlockBreakEvent e) {
Player p = e.getPlayer();
if (Welt.noPermission(p, Permission.BUILD)) {
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke abbauen");
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockCanBuild(BlockCanBuildEvent e) {
if (Core.getVersion() == 12) return;
Player p = e.getPlayer();
try {
if (Welt.noPermission(p, Permission.BUILD)) {
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke platzieren");
e.setBuildable(false);
}
} catch (NullPointerException ex) {
//ignored, caused by worldedit brushes
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockPlace(BlockPlaceEvent e) {
if (Core.getVersion() == 15) return;
Player p = e.getPlayer();
try {
if (Welt.noPermission(p, Permission.BUILD)) {
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke platzieren");
e.setCancelled(true);
}
} catch (NullPointerException ex) {
//ignored, caused by worldedit brushes
}
}
private static final String[] shortcutCommands = {"//1", "//2", "//90", "//-90", "//180", "//p", "//c", "//flopy", "//floppy", "//flopyp", "//floppyp", "//u", "//r"};
private boolean isWorldEditCommand(String command) {

Datei anzeigen

@ -370,6 +370,10 @@ public class ScriptListener implements Listener {
scriptExecutor.player.sendMessage(BauSystem.PREFIX + "§cDie ersten beiden Argumente sind Zahlen/Boolsche Werte oder Variablen.");
return -1;
}
if (args.length < 3) {
scriptExecutor.player.sendMessage(BauSystem.PREFIX + "§cDas dritte Argument muss ein JumpPoint sein.");
return -1;
}
int jumpTruePoint = scriptExecutor.jumpPoints.getOrDefault(args[2], -1);
int jumpFalsePoint = args.length > 3 ? scriptExecutor.jumpPoints.getOrDefault(args[3], -1) : -1;

Datei anzeigen

@ -23,6 +23,7 @@ package de.steamwar.bausystem.world;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -63,7 +64,12 @@ public class TNTSimulatorListener implements Listener {
startSimulation(event.getPlayer());
break;
case RIGHT_CLICK_BLOCK:
Vector location = event.getClickedBlock().getLocation().toVector().add(event.getBlockFace().getDirection()).add(HALF);
BlockFace blockFace = event.getBlockFace();
Vector direction = new Vector(blockFace.getModX(), blockFace.getModY(), blockFace.getModZ());
if (blockFace.getModX() != 0 || blockFace.getModY() != 0 || blockFace.getModZ() != 0) {
direction.normalize();
}
Vector location = event.getClickedBlock().getLocation().toVector().add(direction).add(HALF);
TNTSpawn tntSpawn = new TNTSpawn(location);
addTNT(event.getPlayer(), tntSpawn);
editTNT(event.getPlayer(), tntSpawn);

Datei anzeigen

@ -55,7 +55,7 @@ public class TPSUtils {
public static void setTPS(double tps) {
double d = 50 - (50 / (tps / 20.0));
nanoDOffset = Math.max(0, Math.min((long) (d * 1000000), 25000000));
nanoDOffset = Math.max(0, Math.min((long) (d * 1000000), 37500000));
}
public static boolean isWarpAllowed() {

Datei anzeigen

@ -40,13 +40,11 @@ public class Welt {
return true;
switch (perm) {
case BUILD:
return !member1.isBuild();
case WORLDEDIT:
case worldedit:
return !member1.isWorldEdit();
case WORLD:
case world:
return !member1.isWorld();
case MEMBER:
case member:
return false;
default:
return true;
@ -69,11 +67,6 @@ public class Welt {
}
}
public static void toggleBuild(Player p, BauweltMember target) {
target.setBuild(!target.isBuild());
sendMessages(p, target.isBuild(), target, "bauen");
}
public static void toggleWE(Player p, BauweltMember target) {
target.setWorldEdit(!target.isWorldEdit());
sendMessages(p, target.isWorldEdit(), target, "WorldEdit verwenden");