forked from SteamWar/SteamWar
Format code
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
name: Feature Idee
|
name: Feature Idee
|
||||||
about: Du hast eine Idee für ein neues Feature, welches SteamWar nicht hat? Stelle sie hier vor.
|
about: Du hast eine Idee für ein neues Feature, welches SteamWar nicht hat? Stelle sie hier vor.
|
||||||
labels: ["typ/idee"]
|
labels: [ "typ/idee" ]
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -41,7 +41,7 @@ public class AttributesPlaceListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
ItemStack itemStack = event.getItemInHand();
|
ItemStack itemStack = event.getItemInHand();
|
||||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
if (itemMeta == null) return;
|
if (itemMeta == null) return;
|
||||||
|
|||||||
+2
-2
@@ -65,7 +65,7 @@ public class AutostartListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
if (!ItemUtils.isItem(event.getItem(), "autostart")) {
|
if (!ItemUtils.isItem(event.getItem(), "autostart")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ public class AutostartListener implements Listener {
|
|||||||
if (!(event.getPlayer() instanceof Player)) {
|
if (!(event.getPlayer() instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!Permission.BUILD.hasPermission((Player) event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission((Player) event.getPlayer())) return;
|
||||||
if (!ItemUtils.isItem(event.getPlayer().getInventory().getItemInMainHand(), "autostart")) {
|
if (!ItemUtils.isItem(event.getPlayer().getInventory().getItemInMainHand(), "autostart")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -104,7 +104,8 @@ public class BackupCommand extends SWCommand {
|
|||||||
List<String> lore = Arrays.asList(BauSystem.MESSAGE.parse("BACKUP_LORE", p));
|
List<String> lore = Arrays.asList(BauSystem.MESSAGE.parse("BACKUP_LORE", p));
|
||||||
for (int i = 0; i < backups.size(); i++) {
|
for (int i = 0; i < backups.size(); i++) {
|
||||||
RegionBackups.Backup backup = backups.get(i);
|
RegionBackups.Backup backup = backups.get(i);
|
||||||
SWItem swItem = new SWItem(Material.BRICK, BauSystem.MESSAGE.parse("BACKUP_ITEM_NAME", p, backup.getName()), lore, false, clickType -> {});
|
SWItem swItem = new SWItem(Material.BRICK, BauSystem.MESSAGE.parse("BACKUP_ITEM_NAME", p, backup.getName()), lore, false, clickType -> {
|
||||||
|
});
|
||||||
swItem.getItemStack().setAmount(i + 1);
|
swItem.getItemStack().setAmount(i + 1);
|
||||||
swListEntries.add(new SWListInv.SWListEntry<>(swItem, backup));
|
swListEntries.add(new SWListInv.SWListEntry<>(swItem, backup));
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -58,14 +58,14 @@ public class Countingwand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getWandItem(Player player) {
|
public static ItemStack getWandItem(Player player) {
|
||||||
ItemStack itemStack = new SWItem(Material.STICK, BauSystem.MESSAGE.parse("COUNTINGWAND_ITEM_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("COUNTINGWAND_ITEM_LORE1", player), BauSystem.MESSAGE.parse("COUNTINGWAND_ITEM_LORE2", player)), false, null).getItemStack();
|
ItemStack itemStack = new SWItem(Material.STICK, BauSystem.MESSAGE.parse("COUNTINGWAND_ITEM_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("COUNTINGWAND_ITEM_LORE1", player), BauSystem.MESSAGE.parse("COUNTINGWAND_ITEM_LORE2", player)), false, null).getItemStack();
|
||||||
ItemUtils.setItem(itemStack, "countingwand");
|
ItemUtils.setItem(itemStack, "countingwand");
|
||||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
itemMeta.setCustomModelData(1);
|
itemMeta.setCustomModelData(1);
|
||||||
itemStack.setItemMeta(itemMeta);
|
itemStack.setItemMeta(itemMeta);
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCountingwand(ItemStack itemStack) {
|
public boolean isCountingwand(ItemStack itemStack) {
|
||||||
return ItemUtils.isItem(itemStack, "countingwand");
|
return ItemUtils.isItem(itemStack, "countingwand");
|
||||||
|
|||||||
+7
-7
@@ -28,12 +28,12 @@ import org.bukkit.entity.Player;
|
|||||||
@Linked
|
@Linked
|
||||||
public class CountingwandCommand extends SWCommand {
|
public class CountingwandCommand extends SWCommand {
|
||||||
|
|
||||||
public CountingwandCommand() {
|
public CountingwandCommand() {
|
||||||
super("countingwand", "/countingwand", "cwand", "/cwand", "zollstock", "/zollstock");
|
super("countingwand", "/countingwand", "cwand", "/cwand", "zollstock", "/zollstock");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "COUNTINGWAND_COMMAND_HELP")
|
@Register(description = "COUNTINGWAND_COMMAND_HELP")
|
||||||
public void genericCommand(final Player p) {
|
public void genericCommand(final Player p) {
|
||||||
SWUtils.giveItemToPlayer(p, Countingwand.getWandItem(p));
|
SWUtils.giveItemToPlayer(p, Countingwand.getWandItem(p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+17
-17
@@ -30,24 +30,24 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
@Linked
|
@Linked
|
||||||
public class CountingwandGuiItem extends BauGuiItem {
|
public class CountingwandGuiItem extends BauGuiItem {
|
||||||
|
|
||||||
public CountingwandGuiItem() {
|
public CountingwandGuiItem() {
|
||||||
super(22);
|
super(22);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
return Countingwand.getWandItem(player);
|
return Countingwand.getWandItem(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean click(ClickType click, Player p) {
|
public boolean click(ClickType click, Player p) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
p.performCommand("countingwand");
|
p.performCommand("countingwand");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Permission permission() {
|
public Permission permission() {
|
||||||
return Permission.MEMBER;
|
return Permission.MEMBER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+27
-27
@@ -35,35 +35,35 @@ import java.util.Objects;
|
|||||||
@Linked
|
@Linked
|
||||||
public class CountingwandListener implements Listener {
|
public class CountingwandListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockBreak(final BlockBreakEvent event) {
|
public void onBlockBreak(final BlockBreakEvent event) {
|
||||||
if (!Countingwand.isCountingwand(event.getPlayer().getInventory().getItemInMainHand())) {
|
if (!Countingwand.isCountingwand(event.getPlayer().getInventory().getItemInMainHand())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Countingwand.checkSelection(Point.fromLocation(event.getBlock().getLocation()), true, event.getPlayer());
|
Countingwand.checkSelection(Point.fromLocation(event.getBlock().getLocation()), true, event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(final PlayerInteractEvent event) {
|
public void onPlayerInteract(final PlayerInteractEvent event) {
|
||||||
if (!Countingwand.isCountingwand(event.getItem())) {
|
if (!Countingwand.isCountingwand(event.getItem())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_AIR) {
|
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_AIR) {
|
||||||
RayTraceResult rayTraceResult = event.getPlayer().rayTraceBlocks(200, FluidCollisionMode.NEVER);
|
RayTraceResult rayTraceResult = event.getPlayer().rayTraceBlocks(200, FluidCollisionMode.NEVER);
|
||||||
if (rayTraceResult == null) {
|
if (rayTraceResult == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Countingwand.checkSelection(Point.fromLocation(Objects.requireNonNull(rayTraceResult.getHitBlock()).getLocation()), event.getAction() == Action.LEFT_CLICK_AIR, event.getPlayer());
|
Countingwand.checkSelection(Point.fromLocation(Objects.requireNonNull(rayTraceResult.getHitBlock()).getLocation()), event.getAction() == Action.LEFT_CLICK_AIR, event.getPlayer());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Countingwand.checkSelection(Point.fromLocation(Objects.requireNonNull(event.getClickedBlock()).getLocation()), false, event.getPlayer());
|
Countingwand.checkSelection(Point.fromLocation(Objects.requireNonNull(event.getClickedBlock()).getLocation()), false, event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -31,7 +31,7 @@ public class HotbarListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
if (allNull(event.getPlayer().getInventory().getContents()) && allNull(event.getPlayer().getInventory().getArmorContents())) {
|
if (allNull(event.getPlayer().getInventory().getContents()) && allNull(event.getPlayer().getInventory().getArmorContents())) {
|
||||||
DefaultHotbar.setHotbar(event.getPlayer());
|
DefaultHotbar.setHotbar(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -50,7 +50,8 @@ public class InventoryFillBauGuiItem extends BauGuiItem {
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
String loreKey = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false) ? "OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE" : "OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE";
|
String loreKey = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false) ? "OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE" : "OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE";
|
||||||
return new SWItem(Material.HOPPER, BauSystem.MESSAGE.parse("OTHER_ITEMS_INVENTORY_FILL_NAME", player), Collections.singletonList(BauSystem.MESSAGE.parse(loreKey, player)), false, clickType -> {}).getItemStack();
|
return new SWItem(Material.HOPPER, BauSystem.MESSAGE.parse("OTHER_ITEMS_INVENTORY_FILL_NAME", player), Collections.singletonList(BauSystem.MESSAGE.parse(loreKey, player)), false, clickType -> {
|
||||||
|
}).getItemStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -39,7 +39,7 @@ public class InventoryFiller implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
||||||
if (!event.getPlayer().isSneaking()) return;
|
if (!event.getPlayer().isSneaking()) return;
|
||||||
Block block = event.getPlayer().getTargetBlockExact(5);
|
Block block = event.getPlayer().getTargetBlockExact(5);
|
||||||
@@ -61,7 +61,7 @@ public class InventoryFiller implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
||||||
if (!event.getPlayer().isSneaking()) return;
|
if (!event.getPlayer().isSneaking()) return;
|
||||||
ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();
|
ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();
|
||||||
|
|||||||
+9
-5
@@ -58,9 +58,9 @@ public class KillcheckerVisualizer {
|
|||||||
Material.BLACK_CONCRETE,
|
Material.BLACK_CONCRETE,
|
||||||
};
|
};
|
||||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
private static final World WORLD = Bukkit.getWorlds().get(0);
|
||||||
|
|
||||||
private static final double SURROUND = 4.5;
|
private static final double SURROUND = 4.5;
|
||||||
|
|
||||||
private final Point minPoint;
|
private final Point minPoint;
|
||||||
private final Point maxPoint;
|
private final Point maxPoint;
|
||||||
|
|
||||||
@@ -104,7 +104,9 @@ public class KillcheckerVisualizer {
|
|||||||
Block block = WORLD.getBlockAt(x, y, z);
|
Block block = WORLD.getBlockAt(x, y, z);
|
||||||
if (block.getType().isAir()) continue;
|
if (block.getType().isAir()) continue;
|
||||||
String name = block.getType().name();
|
String name = block.getType().name();
|
||||||
if (!name.endsWith("_WOOL") && !name.endsWith("_STAINED_GLASS") && !name.endsWith("_CONCRETE") && !name.endsWith("_TERRACOTTA")) continue;
|
if (!name.endsWith("_WOOL") && !name.endsWith("_STAINED_GLASS") && !name.endsWith("_CONCRETE") && !name.endsWith("_TERRACOTTA")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (name.equals("_GLAZED_TERRACOTTA")) continue;
|
if (name.equals("_GLAZED_TERRACOTTA")) continue;
|
||||||
Cuboid cuboid = create(block.getType(), x, y, z);
|
Cuboid cuboid = create(block.getType(), x, y, z);
|
||||||
cuboids.add(cuboid);
|
cuboids.add(cuboid);
|
||||||
@@ -283,7 +285,9 @@ public class KillcheckerVisualizer {
|
|||||||
}
|
}
|
||||||
kill.forEach((point, count) -> {
|
kill.forEach((point, count) -> {
|
||||||
if (rEntities.containsKey(point)) {
|
if (rEntities.containsKey(point)) {
|
||||||
if (killCount.get(point) == count && outlinePoints.contains(point) == outlinePointsCacheLast.contains(point)) return;
|
if (killCount.get(point) == count && outlinePoints.contains(point) == outlinePointsCacheLast.contains(point)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rEntities.get(point).die();
|
rEntities.get(point).die();
|
||||||
}
|
}
|
||||||
RFallingBlockEntity entity = new RFallingBlockEntity(outlinePoints.contains(point) ? outline : inner, point.toLocation(WORLD, 0.5, 0, 0.5), MATERIALS[Math.min(count - 1, MATERIALS.length) - 1]);
|
RFallingBlockEntity entity = new RFallingBlockEntity(outlinePoints.contains(point) ? outline : inner, point.toLocation(WORLD, 0.5, 0, 0.5), MATERIALS[Math.min(count - 1, MATERIALS.length) - 1]);
|
||||||
@@ -325,7 +329,7 @@ public class KillcheckerVisualizer {
|
|||||||
if (point.getX() < minPoint.getX() || point.getX() > maxPoint.getX()) continue;
|
if (point.getX() < minPoint.getX() || point.getX() > maxPoint.getX()) continue;
|
||||||
if (point.getY() < minPoint.getY() || point.getY() > maxPoint.getY()) continue;
|
if (point.getY() < minPoint.getY() || point.getY() > maxPoint.getY()) continue;
|
||||||
if (point.getZ() < minPoint.getZ() || point.getZ() > maxPoint.getZ()) continue;
|
if (point.getZ() < minPoint.getZ() || point.getZ() > maxPoint.getZ()) continue;
|
||||||
|
|
||||||
if (WORLD.getBlockAt(point.getX() + 1, point.getY(), point.getZ()).getType() == type) {
|
if (WORLD.getBlockAt(point.getX() + 1, point.getY(), point.getZ()).getType() == type) {
|
||||||
points.add(new Point(point.getX() + 1, point.getY(), point.getZ()));
|
points.add(new Point(point.getX() + 1, point.getY(), point.getZ()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class Loader implements Listener, SWPlayer.Component {
|
|||||||
|
|
||||||
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> {
|
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> {
|
||||||
if (stage != Stage.RUNNING && stage != Stage.SINGLE) return;
|
if (stage != Stage.RUNNING && stage != Stage.SINGLE) return;
|
||||||
if(!Permission.BUILD.hasPermission(p)) return;
|
if (!Permission.BUILD.hasPermission(p)) return;
|
||||||
if (waitTime > 0) {
|
if (waitTime > 0) {
|
||||||
waitTime--;
|
waitTime--;
|
||||||
return;
|
return;
|
||||||
@@ -213,7 +213,8 @@ public class Loader implements Listener, SWPlayer.Component {
|
|||||||
};
|
};
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
|
|
||||||
SWListInv<LoaderElement> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("LOADER_GUI_TITLE", p), false, list, (clickType, loaderElement) -> {});
|
SWListInv<LoaderElement> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("LOADER_GUI_TITLE", p), false, list, (clickType, loaderElement) -> {
|
||||||
|
});
|
||||||
swListInv.setCallback((clickType, entry) -> entry.click(p, () -> {
|
swListInv.setCallback((clickType, entry) -> entry.click(p, () -> {
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
swListInv.open();
|
swListInv.open();
|
||||||
@@ -363,7 +364,9 @@ public class Loader implements Listener, SWPlayer.Component {
|
|||||||
public static int LENGTH = SettingsSorting.values().length;
|
public static int LENGTH = SettingsSorting.values().length;
|
||||||
|
|
||||||
public abstract Material getMaterial();
|
public abstract Material getMaterial();
|
||||||
|
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
||||||
public abstract boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next);
|
public abstract boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ public class LoaderScoreboardElement implements ScoreboardElement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String get(Region region, Player p) {
|
public String get(Region region, Player p) {
|
||||||
if(!Permission.BUILD.hasPermission(p)) return null;
|
if (!Permission.BUILD.hasPermission(p)) return null;
|
||||||
Loader loader = Loader.getLoader(p);
|
Loader loader = Loader.getLoader(p);
|
||||||
if (loader == null) return null;
|
if (loader == null) return null;
|
||||||
if (loader.getStage() == Loader.Stage.RUNNING) {
|
if (loader.getStage() == Loader.Stage.RUNNING) {
|
||||||
|
|||||||
+2
@@ -26,6 +26,8 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
public interface LoaderElement {
|
public interface LoaderElement {
|
||||||
SWItem menu(Player player);
|
SWItem menu(Player player);
|
||||||
|
|
||||||
void execute(Consumer<Long> delay);
|
void execute(Consumer<Long> delay);
|
||||||
|
|
||||||
void click(Player player, Runnable backAction);
|
void click(Player player, Runnable backAction);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-6
@@ -95,7 +95,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
};
|
};
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
|
|
||||||
SWListInv<Integer> listInv = new SWListInv<>(player, "Interaction Settings", false, entries, (clickType, entry) -> {});
|
SWListInv<Integer> listInv = new SWListInv<>(player, "Interaction Settings", false, entries, (clickType, entry) -> {
|
||||||
|
});
|
||||||
listInv.setCallback((clickType, entry) -> {
|
listInv.setCallback((clickType, entry) -> {
|
||||||
openIndividualSettingsMenu(player, entry, () -> {
|
openIndividualSettingsMenu(player, entry, () -> {
|
||||||
updateRunnable.run();
|
updateRunnable.run();
|
||||||
@@ -150,7 +151,9 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
|
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
|
||||||
for (int i = guiSize - 9; i < guiSize; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {}));
|
for (int i = guiSize - 9; i < guiSize; i++)
|
||||||
|
swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {
|
||||||
|
}));
|
||||||
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> back.run());
|
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> back.run());
|
||||||
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
|
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
|
||||||
@@ -197,7 +200,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
for (int power = 0; power < 16; power++) {
|
for (int power = 0; power < 16; power++) {
|
||||||
int finalPowerPosition = power;
|
int finalPowerPosition = power;
|
||||||
if (power >= 9) finalPowerPosition++;
|
if (power >= 9) finalPowerPosition++;
|
||||||
SWItem powerItem = new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("LOADER_SETTING_POWER", player, power), Arrays.asList(), false, clickType -> {});
|
SWItem powerItem = new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("LOADER_SETTING_POWER", player, power), Arrays.asList(), false, clickType -> {
|
||||||
|
});
|
||||||
powerItem.getItemStack().setAmount(Math.max(power, 1));
|
powerItem.getItemStack().setAmount(Math.max(power, 1));
|
||||||
if (extraPower.get(index) == power) powerItem.setEnchanted(true);
|
if (extraPower.get(index) == power) powerItem.setEnchanted(true);
|
||||||
|
|
||||||
@@ -210,7 +214,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentElement.hasTicks(this)) {
|
if (currentElement.hasTicks(this)) {
|
||||||
swInventory.setItem(ticksStart + 3, new SWItem(Material.RED_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(ticksStart + 3, new SWItem(Material.RED_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
long ticks = extraTicks.get(index);
|
long ticks = extraTicks.get(index);
|
||||||
ticks -= clickType.isShiftClick() ? 5 : 1;
|
ticks -= clickType.isShiftClick() ? 5 : 1;
|
||||||
if (ticks < 1) ticks = 1;
|
if (ticks < 1) ticks = 1;
|
||||||
@@ -218,7 +223,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
openIndividualSettingsMenu(player, index, back, delete);
|
openIndividualSettingsMenu(player, index, back, delete);
|
||||||
});
|
});
|
||||||
|
|
||||||
SWItem ticksItem = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS", player, extraTicks.get(index)), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)), false, clickType -> {});
|
SWItem ticksItem = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS", player, extraTicks.get(index)), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)), false, clickType -> {
|
||||||
|
});
|
||||||
ticksItem.getItemStack().setAmount((int) Math.min(extraTicks.get(index), 64));
|
ticksItem.getItemStack().setAmount((int) Math.min(extraTicks.get(index), 64));
|
||||||
swInventory.setItem(ticksStart + 4, ticksItem.getItemStack(), clickType -> {
|
swInventory.setItem(ticksStart + 4, ticksItem.getItemStack(), clickType -> {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_NAME", player), extraTicks.get(index) + "");
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_NAME", player), extraTicks.get(index) + "");
|
||||||
@@ -234,7 +240,8 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
swAnvilInv.open();
|
swAnvilInv.open();
|
||||||
});
|
});
|
||||||
|
|
||||||
swInventory.setItem(ticksStart + 5, new SWItem(Material.LIME_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(ticksStart + 5, new SWItem(Material.LIME_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
long ticks = extraTicks.get(index);
|
long ticks = extraTicks.get(index);
|
||||||
ticks += clickType.isShiftClick() ? 5 : 1;
|
ticks += clickType.isShiftClick() ? 5 : 1;
|
||||||
extraTicks.set(index, ticks);
|
extraTicks.set(index, ticks);
|
||||||
|
|||||||
+3
@@ -28,10 +28,13 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
public interface LoaderSettingsEnum<T, P extends LoaderInteractionElement<E>, E extends Enum<E> & LoaderSettingsEnum<T, P, E>> {
|
public interface LoaderSettingsEnum<T, P extends LoaderInteractionElement<E>, E extends Enum<E> & LoaderSettingsEnum<T, P, E>> {
|
||||||
int getPos();
|
int getPos();
|
||||||
|
|
||||||
SWItem menu(Player player, P parent, int power, long ticks);
|
SWItem menu(Player player, P parent, int power, long ticks);
|
||||||
|
|
||||||
default boolean hasPower(P parent) {
|
default boolean hasPower(P parent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean hasTicks(P parent) {
|
default boolean hasTicks(P parent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -63,7 +63,8 @@ public class LoaderWait implements LoaderElement {
|
|||||||
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
|
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
|
||||||
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> backAction.run());
|
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> backAction.run());
|
||||||
|
|
||||||
swInventory.setItem(3, new SWItem(Material.RED_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(3, new SWItem(Material.RED_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
delay -= clickType.isShiftClick() ? 5 : 1;
|
delay -= clickType.isShiftClick() ? 5 : 1;
|
||||||
if (delay < 0) delay = 0;
|
if (delay < 0) delay = 0;
|
||||||
swInventory.setItem(4, menu(player));
|
swInventory.setItem(4, menu(player));
|
||||||
@@ -80,7 +81,8 @@ public class LoaderWait implements LoaderElement {
|
|||||||
});
|
});
|
||||||
swAnvilInv.open();
|
swAnvilInv.open();
|
||||||
});
|
});
|
||||||
swInventory.setItem(5, new SWItem(Material.LIME_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(5, new SWItem(Material.LIME_DYE, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {
|
||||||
|
}).getItemStack(), clickType -> {
|
||||||
delay += clickType.isShiftClick() ? 5 : 1;
|
delay += clickType.isShiftClick() ? 5 : 1;
|
||||||
swInventory.setItem(4, menu(player));
|
swInventory.setItem(4, menu(player));
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-2
@@ -146,8 +146,7 @@ public class Loadtimer implements Listener {
|
|||||||
if ((stage == Stage.COUNTING || stage == Stage.ACTIVATED)) {
|
if ((stage == Stage.COUNTING || stage == Stage.ACTIVATED)) {
|
||||||
stage = Stage.IGNITION;
|
stage = Stage.IGNITION;
|
||||||
ignite = TPSUtils.currentRealTick.get();
|
ignite = TPSUtils.currentRealTick.get();
|
||||||
if (activate == -1)
|
if (activate == -1) activate = TPSUtils.currentRealTick.get();
|
||||||
activate = TPSUtils.currentRealTick.get();
|
|
||||||
if (finishOnActive) {
|
if (finishOnActive) {
|
||||||
stage = Stage.END;
|
stage = Stage.END;
|
||||||
print();
|
print();
|
||||||
|
|||||||
+4
-2
@@ -40,16 +40,18 @@ public class LoadtimerCommand extends SWCommand {
|
|||||||
public void start(@Validator Player p, TimerMode mode) {
|
public void start(@Validator Player p, TimerMode mode) {
|
||||||
Region r = Region.getRegion(p.getLocation());
|
Region r = Region.getRegion(p.getLocation());
|
||||||
if (r.getType().isGlobal()) return;
|
if (r.getType().isGlobal()) return;
|
||||||
if (!Loadtimer.hasTimer(r))
|
if (!Loadtimer.hasTimer(r)) {
|
||||||
Loadtimer.createLoadtimer(r, mode == TimerMode.HALF);
|
Loadtimer.createLoadtimer(r, mode == TimerMode.HALF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
||||||
public void stop(@Validator Player p) {
|
public void stop(@Validator Player p) {
|
||||||
Region r = Region.getRegion(p.getLocation());
|
Region r = Region.getRegion(p.getLocation());
|
||||||
if (r.getType().isGlobal()) return;
|
if (r.getType().isGlobal()) return;
|
||||||
if (Loadtimer.hasTimer(r))
|
if (Loadtimer.hasTimer(r)) {
|
||||||
Loadtimer.getTimer(r).delete();
|
Loadtimer.getTimer(r).delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TimerMode {
|
public enum TimerMode {
|
||||||
|
|||||||
+2
-1
@@ -46,8 +46,9 @@ public class LoadtimerGuiItem extends BauGuiItem {
|
|||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
Region r = Region.getRegion(player.getLocation());
|
Region r = Region.getRegion(player.getLocation());
|
||||||
if (r.getType().isGlobal())
|
if (r.getType().isGlobal()) {
|
||||||
return new SWItem(Material.BOWL, BauSystem.MESSAGE.parse("LOADTIMER_GUI_GLOBAL", player)).getItemStack();
|
return new SWItem(Material.BOWL, BauSystem.MESSAGE.parse("LOADTIMER_GUI_GLOBAL", player)).getItemStack();
|
||||||
|
}
|
||||||
if (Loadtimer.hasTimer(r)) {
|
if (Loadtimer.hasTimer(r)) {
|
||||||
return new SWItem(Material.BOW, BauSystem.MESSAGE.parse("LOADTIMER_GUI_STOP", player)).getItemStack();
|
return new SWItem(Material.BOW, BauSystem.MESSAGE.parse("LOADTIMER_GUI_STOP", player)).getItemStack();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ public class ObserverTracerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
if (!enabled.contains(event.getPlayer())) return;
|
if (!enabled.contains(event.getPlayer())) return;
|
||||||
if (event.getClickedBlock() == null) return;
|
if (event.getClickedBlock() == null) return;
|
||||||
ObserverTracer observerTracer = SWPlayer.of(event.getPlayer()).getComponent(ObserverTracer.class).orElse(null);
|
ObserverTracer observerTracer = SWPlayer.of(event.getPlayer()).getComponent(ObserverTracer.class).orElse(null);
|
||||||
|
|||||||
+3
-3
@@ -61,9 +61,9 @@ public class RayVisualizerCommand extends SWCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean locEquals(Location loc1, Location loc2) {
|
private boolean locEquals(Location loc1, Location loc2) {
|
||||||
if ((long)(loc1.getX() * 1000) != (long)(loc2.getX() * 1000)) return false;
|
if ((long) (loc1.getX() * 1000) != (long) (loc2.getX() * 1000)) return false;
|
||||||
if ((long)(loc1.getY() * 1000) != (long)(loc2.getY() * 1000)) return false;
|
if ((long) (loc1.getY() * 1000) != (long) (loc2.getY() * 1000)) return false;
|
||||||
if ((long)(loc1.getZ() * 1000) != (long)(loc2.getZ() * 1000)) return false;
|
if ((long) (loc1.getZ() * 1000) != (long) (loc2.getZ() * 1000)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -36,12 +36,16 @@ public class FireListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFireDamage(BlockBurnEvent e) {
|
public void onFireDamage(BlockBurnEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFireSpread(BlockSpreadEvent e) {
|
public void onFireSpread(BlockSpreadEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) e.setCancelled(true);
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -44,11 +44,11 @@ public class FreezeCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getEnableMessage(){
|
private String getEnableMessage() {
|
||||||
return "REGION_FREEZE_ENABLED";
|
return "REGION_FREEZE_ENABLED";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDisableMessage(){
|
private String getDisableMessage() {
|
||||||
return "REGION_FREEZE_DISABLED";
|
return "REGION_FREEZE_DISABLED";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -47,7 +47,9 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockExplode(BlockExplodeEvent e) {
|
public void onBlockExplode(BlockExplodeEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
BlockState state = e.getBlock().getState();
|
BlockState state = e.getBlock().getState();
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
@@ -57,7 +59,9 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||||
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
if (e.getEntityType() == EntityType.TNT) {
|
if (e.getEntityType() == EntityType.TNT) {
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
@@ -69,7 +73,9 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockCanBuild(BlockCanBuildEvent e) {
|
public void onBlockCanBuild(BlockCanBuildEvent e) {
|
||||||
if (!e.isBuildable()) return;
|
if (!e.isBuildable()) return;
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
|
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (e.getMaterial() == Material.TNT) {
|
if (e.getMaterial() == Material.TNT) {
|
||||||
e.setBuildable(false);
|
e.setBuildable(false);
|
||||||
e.getBlock().setType(Material.TNT, false);
|
e.getBlock().setType(Material.TNT, false);
|
||||||
|
|||||||
+2
-2
@@ -44,11 +44,11 @@ public class ItemsCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getEnableMessage(){
|
private String getEnableMessage() {
|
||||||
return "REGION_ITEMS_ENABLED";
|
return "REGION_ITEMS_ENABLED";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDisableMessage(){
|
private String getDisableMessage() {
|
||||||
return "REGION_ITEMS_DISABLED";
|
return "REGION_ITEMS_DISABLED";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -97,7 +97,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE")
|
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE")
|
||||||
public void genericRestoreCommand(@Validator Player p) {
|
public void genericRestoreCommand(@Validator Player p) {
|
||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if(checkGlobalRegion(region, p)) return;
|
if (checkGlobalRegion(region, p)) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getArea().getResetFile()))
|
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getArea().getResetFile()))
|
||||||
@@ -116,7 +116,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (checkGlobalRegion(region, p)) return;
|
if (checkGlobalRegion(region, p)) return;
|
||||||
|
|
||||||
if(node.isDir()) {
|
if (node.isDir()) {
|
||||||
BauSystem.MESSAGE.send("ONLY_SCHEMS", p);
|
BauSystem.MESSAGE.send("ONLY_SCHEMS", p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -59,7 +59,9 @@ public class RegionListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockPhysics(final BlockPhysicsEvent event) {
|
public void onBlockPhysics(final BlockPhysicsEvent event) {
|
||||||
if (event.getBlock().getType() != event.getChangedType()) RegionListener.tagChangedRegion(event.getBlock().getLocation());
|
if (event.getBlock().getType() != event.getChangedType()) {
|
||||||
|
RegionListener.tagChangedRegion(event.getBlock().getLocation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ public class TestblockCommand extends SWCommand {
|
|||||||
resetRegion(p, node, isExtension ? RegionExtensionType.EXTENSION : RegionExtensionType.NORMAL, isIgnoreAir, isOnlyColor, replaceTNT, replaceWater);
|
resetRegion(p, node, isExtension ? RegionExtensionType.EXTENSION : RegionExtensionType.NORMAL, isIgnoreAir, isOnlyColor, replaceTNT, replaceWater);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(value="default")
|
@Register(value = "default")
|
||||||
public void setTestblockDefault(Player p) {
|
public void setTestblockDefault(Player p) {
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
|
|||||||
+2
-2
@@ -33,11 +33,11 @@ public class WaterDestroyCommand extends SWCommand {
|
|||||||
super("waterdestroy");
|
super("waterdestroy");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getEnableMessage(){
|
private String getEnableMessage() {
|
||||||
return "REGION_WATER_ENABLED";
|
return "REGION_WATER_ENABLED";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDisableMessage(){
|
private String getDisableMessage() {
|
||||||
return "REGION_WATER_DISABLED";
|
return "REGION_WATER_DISABLED";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -36,7 +36,9 @@ public class WaterDestroyListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockFromTo(BlockFromToEvent event) {
|
public void onBlockFromTo(BlockFromToEvent event) {
|
||||||
if (event.getBlock().getType() == Material.WATER && event.getToBlock().getType() != Material.AIR && Region.getRegion(event.getBlock().getLocation()).getRegionData().get(Flag.WATER_DESTROY).isWithDefault(WaterDestroyMode.DENY)) event.setCancelled(true);
|
if (event.getBlock().getType() == Material.WATER && event.getToBlock().getType() != Material.AIR && Region.getRegion(event.getBlock().getLocation()).getRegionData().get(Flag.WATER_DESTROY).isWithDefault(WaterDestroyMode.DENY)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class ScriptGUI implements Listener {
|
|||||||
lore.add(BauSystem.MESSAGE.parse("SCRIPT_ERROR_GUI", player, String.join(":", Arrays.copyOfRange(sp, 1, sp.length))));
|
lore.add(BauSystem.MESSAGE.parse("SCRIPT_ERROR_GUI", player, String.join(":", Arrays.copyOfRange(sp, 1, sp.length))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!lore.isEmpty()) {
|
if (!lore.isEmpty()) {
|
||||||
lore.add("");
|
lore.add("");
|
||||||
}
|
}
|
||||||
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_1", player));
|
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_1", player));
|
||||||
@@ -75,16 +75,17 @@ public class ScriptGUI implements Listener {
|
|||||||
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_3", player));
|
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_3", player));
|
||||||
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_4", player));
|
lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_4", player));
|
||||||
|
|
||||||
entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.ENCHANTED_BOOK, script.getName(), new ArrayList<>(lore), false, clickType -> {}), script));
|
entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.ENCHANTED_BOOK, script.getName(), new ArrayList<>(lore), false, clickType -> {
|
||||||
|
}), script));
|
||||||
lore.clear();
|
lore.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
SWListInv<Script> inv = new SWListInv<>(player, BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_NAME", player), false, entries, (clickType, script) -> {
|
SWListInv<Script> inv = new SWListInv<>(player, BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_NAME", player), false, entries, (clickType, script) -> {
|
||||||
ItemStack itemStack = ScriptHelper.getScriptItem(script, clickType.isRightClick());
|
ItemStack itemStack = ScriptHelper.getScriptItem(script, clickType.isRightClick());
|
||||||
|
|
||||||
if(clickType == ClickType.MIDDLE) {
|
if (clickType == ClickType.MIDDLE) {
|
||||||
player.openBook(itemStack);
|
player.openBook(itemStack);
|
||||||
} else if(!clickType.isShiftClick()) {
|
} else if (!clickType.isShiftClick()) {
|
||||||
script.delete();
|
script.delete();
|
||||||
ScriptRunner.updateGlobalScript(player);
|
ScriptRunner.updateGlobalScript(player);
|
||||||
open(player, itemStack);
|
open(player, itemStack);
|
||||||
@@ -93,14 +94,14 @@ public class ScriptGUI implements Listener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
inv.setItem(49, Material.HOPPER, BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_ADD_NAME", player), Collections.singletonList(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_ADD_LORE", player)), false, click -> {
|
inv.setItem(49, Material.HOPPER, BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_ADD_NAME", player), Collections.singletonList(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_ADD_LORE", player)), false, click -> {
|
||||||
if(player.getOpenInventory().getCursor() != null) {
|
if (player.getOpenInventory().getCursor() != null) {
|
||||||
ItemStack cursor = player.getOpenInventory().getCursor();
|
ItemStack cursor = player.getOpenInventory().getCursor();
|
||||||
if(!(cursor.getItemMeta() instanceof BookMeta)) {
|
if (!(cursor.getItemMeta() instanceof BookMeta)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BookMeta meta = (BookMeta) cursor.getItemMeta();
|
BookMeta meta = (BookMeta) cursor.getItemMeta();
|
||||||
if(meta == null) {
|
if (meta == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,14 +109,14 @@ public class ScriptGUI implements Listener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
inv.open();
|
inv.open();
|
||||||
if(setCursor != null) {
|
if (setCursor != null) {
|
||||||
player.getOpenInventory().setCursor(setCursor);
|
player.getOpenInventory().setCursor(setCursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void saveWithName(Player player, BookMeta meta, String name) {
|
private static void saveWithName(Player player, BookMeta meta, String name) {
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
if(name != null && Script.list(user).stream().noneMatch(script -> script.getName().equalsIgnoreCase(name))) {
|
if (name != null && Script.list(user).stream().noneMatch(script -> script.getName().equalsIgnoreCase(name))) {
|
||||||
Script.create(user, name, ScriptHelper.getScriptString(meta.getPages()));
|
Script.create(user, name, ScriptHelper.getScriptString(meta.getPages()));
|
||||||
player.getOpenInventory().setCursor(null);
|
player.getOpenInventory().setCursor(null);
|
||||||
ScriptRunner.updateGlobalScript(player);
|
ScriptRunner.updateGlobalScript(player);
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ public class ScriptHelper {
|
|||||||
public static ItemStack getScriptItem(Script script, boolean writeable) {
|
public static ItemStack getScriptItem(Script script, boolean writeable) {
|
||||||
ItemStack itemStack = new ItemStack(writeable ? Material.WRITABLE_BOOK : Material.WRITTEN_BOOK);
|
ItemStack itemStack = new ItemStack(writeable ? Material.WRITABLE_BOOK : Material.WRITTEN_BOOK);
|
||||||
BookMeta meta = (BookMeta) itemStack.getItemMeta();
|
BookMeta meta = (BookMeta) itemStack.getItemMeta();
|
||||||
if(!writeable) {
|
if (!writeable) {
|
||||||
meta.setTitle(script.getName());
|
meta.setTitle(script.getName());
|
||||||
meta.setAuthor(SteamwarUser.byId(script.getUserId()).getUserName());
|
meta.setAuthor(SteamwarUser.byId(script.getUserId()).getUserName());
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -44,7 +44,7 @@ public class ScriptListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onLeftClick(PlayerInteractEvent event) {
|
public void onLeftClick(PlayerInteractEvent event) {
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
|
|
||||||
ItemStack item = event.getItem();
|
ItemStack item = event.getItem();
|
||||||
if (item == null || FlatteningWrapper.impl.isNoBook(item) || item.getItemMeta() == null) {
|
if (item == null || FlatteningWrapper.impl.isNoBook(item) || item.getItemMeta() == null) {
|
||||||
@@ -72,7 +72,7 @@ public class ScriptListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
ScriptRunner.updateGlobalScript(event.getPlayer());
|
ScriptRunner.updateGlobalScript(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -102,7 +102,7 @@ public class ScriptRunner {
|
|||||||
.orElse(Collections.emptyMap())
|
.orElse(Collections.emptyMap())
|
||||||
.getOrDefault(event, Collections.emptyList());
|
.getOrDefault(event, Collections.emptyList());
|
||||||
if (luaFunctions.isEmpty()) {
|
if (luaFunctions.isEmpty()) {
|
||||||
if(event == SteamWarGlobalLuaPlugin.EventType.DoubleSwap) {
|
if (event == SteamWarGlobalLuaPlugin.EventType.DoubleSwap) {
|
||||||
player.performCommand("gui");
|
player.performCommand("gui");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ public class CommandListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
String[] split = event.getMessage().split(" ");
|
String[] split = event.getMessage().split(" ");
|
||||||
ScriptRunner.ScriptData scriptData = SWPlayer.of(event.getPlayer()).getComponentOrDefault(ScriptRunner.ScriptData.class, ScriptRunner.ScriptData::new);
|
ScriptRunner.ScriptData scriptData = SWPlayer.of(event.getPlayer()).getComponentOrDefault(ScriptRunner.ScriptData.class, ScriptRunner.ScriptData::new);
|
||||||
if (scriptData.getCalledCommands().contains(split[0])) return;
|
if (scriptData.getCalledCommands().contains(split[0])) return;
|
||||||
|
|||||||
+15
-7
@@ -72,7 +72,7 @@ public interface LuaLib {
|
|||||||
|
|
||||||
default LuaTable toPos(Point point) {
|
default LuaTable toPos(Point point) {
|
||||||
if (point == null) return LuaTable.tableOf();
|
if (point == null) return LuaTable.tableOf();
|
||||||
return LuaValue.tableOf(new LuaValue[] {
|
return LuaValue.tableOf(new LuaValue[]{
|
||||||
LuaValue.valueOf("x"), LuaValue.valueOf(point.getX()),
|
LuaValue.valueOf("x"), LuaValue.valueOf(point.getX()),
|
||||||
LuaValue.valueOf("y"), LuaValue.valueOf(point.getY()),
|
LuaValue.valueOf("y"), LuaValue.valueOf(point.getY()),
|
||||||
LuaValue.valueOf("z"), LuaValue.valueOf(point.getZ())
|
LuaValue.valueOf("z"), LuaValue.valueOf(point.getZ())
|
||||||
@@ -82,7 +82,9 @@ public interface LuaLib {
|
|||||||
default Class<? extends LuaLib> parent() {
|
default Class<? extends LuaLib> parent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name();
|
String name();
|
||||||
|
|
||||||
LuaTable get(Player player);
|
LuaTable get(Player player);
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -103,27 +105,33 @@ public interface LuaLib {
|
|||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.toboolean());
|
consumer.accept(luaValue.toboolean());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ingored) {}
|
} catch (Exception ingored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept((long) luaValue.toint());
|
consumer.accept((long) luaValue.toint());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.toint());
|
consumer.accept(luaValue.toint());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.todouble());
|
consumer.accept(luaValue.todouble());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept((float) luaValue.todouble());
|
consumer.accept((float) luaValue.todouble());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
consumer.accept(luaValue.toString());
|
consumer.accept(luaValue.toString());
|
||||||
return NIL;
|
return NIL;
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
throw new LuaError("Invalid lua type: " + luaValue.typename());
|
throw new LuaError("Invalid lua type: " + luaValue.typename());
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
throw new LuaError("Error in '" + name + "' " + throwable.getMessage());
|
throw new LuaError("Error in '" + name + "' " + throwable.getMessage());
|
||||||
|
|||||||
+6
-6
@@ -84,12 +84,12 @@ public class RandomLib implements LuaLib {
|
|||||||
|
|
||||||
private static class NextBool extends VarArgFunction {
|
private static class NextBool extends VarArgFunction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Varargs invoke(Varargs args) {
|
public Varargs invoke(Varargs args) {
|
||||||
if (args.narg() == 0) {
|
if (args.narg() == 0) {
|
||||||
return LuaValue.valueOf(random.nextBoolean());
|
return LuaValue.valueOf(random.nextBoolean());
|
||||||
}
|
|
||||||
throw new LuaError("Invalid number of arguments for random.nextBoolean() zero expected got " + args.narg());
|
|
||||||
}
|
}
|
||||||
|
throw new LuaError("Invalid number of arguments for random.nextBoolean() zero expected got " + args.narg());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -78,7 +78,7 @@ public class RegionLib implements LuaLib {
|
|||||||
|
|
||||||
Loader loader = Loader.getLoader(player);
|
Loader loader = Loader.getLoader(player);
|
||||||
table.set("loader", getter(() -> loader == null ? "OFF" : loader.getStage().name()));
|
table.set("loader", getter(() -> loader == null ? "OFF" : loader.getStage().name()));
|
||||||
|
|
||||||
table.set("copyPoint", getter(() -> toPos(region.get().getBuildArea().getCopyPoint())));
|
table.set("copyPoint", getter(() -> toPos(region.get().getBuildArea().getCopyPoint())));
|
||||||
table.set("minPointBuild", getter(() -> toPos(region.get().getBuildArea().getMinPoint(false))));
|
table.set("minPointBuild", getter(() -> toPos(region.get().getBuildArea().getMinPoint(false))));
|
||||||
table.set("maxPointBuild", getter(() -> toPos(region.get().getBuildArea().getMinPoint(false))));
|
table.set("maxPointBuild", getter(() -> toPos(region.get().getBuildArea().getMinPoint(false))));
|
||||||
|
|||||||
+33
-15
@@ -62,7 +62,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
jsonObject.keySet().forEach(key -> {
|
jsonObject.keySet().forEach(key -> {
|
||||||
GLOBAL_STORAGE.put(key, fromJson(jsonObject.get(key)));
|
GLOBAL_STORAGE.put(key, fromJson(jsonObject.get(key)));
|
||||||
});
|
});
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
File regionStorageDirectory = new File(storageDirectory, "region");
|
File regionStorageDirectory = new File(storageDirectory, "region");
|
||||||
regionStorageDirectory.mkdirs();
|
regionStorageDirectory.mkdirs();
|
||||||
@@ -75,7 +76,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
});
|
});
|
||||||
Region region = RegionSystem.INSTANCE.getRegion(UUID.fromString(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length()))).orElse(null);
|
Region region = RegionSystem.INSTANCE.getRegion(UUID.fromString(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length()))).orElse(null);
|
||||||
REGION_STORAGE.put(region, map);
|
REGION_STORAGE.put(region, map);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File playerStorageDirectory = new File(storageDirectory, "player");
|
File playerStorageDirectory = new File(storageDirectory, "player");
|
||||||
@@ -89,7 +91,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
});
|
});
|
||||||
SteamwarUser steamwarUser = SteamwarUser.byId(Integer.parseInt(playerStorage.getName().substring(0, playerStorage.getName().length() - ".json".length())));
|
SteamwarUser steamwarUser = SteamwarUser.byId(Integer.parseInt(playerStorage.getName().substring(0, playerStorage.getName().length() - ".json".length())));
|
||||||
PLAYER_STORAGE.put(steamwarUser.getUUID(), map);
|
PLAYER_STORAGE.put(steamwarUser.getUUID(), map);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,10 +108,12 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
if (jsonPrimitive.isNumber()) {
|
if (jsonPrimitive.isNumber()) {
|
||||||
try {
|
try {
|
||||||
return LuaValue.valueOf(jsonPrimitive.getAsInt());
|
return LuaValue.valueOf(jsonPrimitive.getAsInt());
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return LuaValue.valueOf(jsonPrimitive.getAsDouble());
|
return LuaValue.valueOf(jsonPrimitive.getAsDouble());
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (jsonPrimitive.isString()) {
|
if (jsonPrimitive.isString()) {
|
||||||
return LuaValue.valueOf(jsonPrimitive.getAsString());
|
return LuaValue.valueOf(jsonPrimitive.getAsString());
|
||||||
@@ -135,7 +140,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
FileWriter fileWriter = new FileWriter(new File(storageDirectory, "global.json"));
|
FileWriter fileWriter = new FileWriter(new File(storageDirectory, "global.json"));
|
||||||
gson.toJson(toJson(GLOBAL_STORAGE), fileWriter);
|
gson.toJson(toJson(GLOBAL_STORAGE), fileWriter);
|
||||||
fileWriter.close();
|
fileWriter.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
File regionStorageDirectory = new File(storageDirectory, "region");
|
File regionStorageDirectory = new File(storageDirectory, "region");
|
||||||
regionStorageDirectory.mkdirs();
|
regionStorageDirectory.mkdirs();
|
||||||
@@ -144,7 +150,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
FileWriter fileWriter = new FileWriter(new File(regionStorageDirectory, entry.getKey().getID().toString() + ".json"));
|
FileWriter fileWriter = new FileWriter(new File(regionStorageDirectory, entry.getKey().getID().toString() + ".json"));
|
||||||
gson.toJson(toJson(entry.getValue()), fileWriter);
|
gson.toJson(toJson(entry.getValue()), fileWriter);
|
||||||
fileWriter.close();
|
fileWriter.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File playerStorageDirectory = new File(storageDirectory, "player");
|
File playerStorageDirectory = new File(storageDirectory, "player");
|
||||||
@@ -154,7 +161,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
FileWriter fileWriter = new FileWriter(new File(playerStorageDirectory, SteamwarUser.get(entry.getKey()).getId() + ".json"));
|
FileWriter fileWriter = new FileWriter(new File(playerStorageDirectory, SteamwarUser.get(entry.getKey()).getId() + ".json"));
|
||||||
gson.toJson(toJson(entry.getValue()), fileWriter);
|
gson.toJson(toJson(entry.getValue()), fileWriter);
|
||||||
fileWriter.close();
|
fileWriter.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,13 +182,16 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new JsonPrimitive(luaValue.checkboolean());
|
return new JsonPrimitive(luaValue.checkboolean());
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return new JsonPrimitive(luaValue.checkint());
|
return new JsonPrimitive(luaValue.checkint());
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return new JsonPrimitive(luaValue.checkdouble());
|
return new JsonPrimitive(luaValue.checkdouble());
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
if (luaValue.isstring()) {
|
if (luaValue.isstring()) {
|
||||||
return new JsonPrimitive(luaValue.tojstring());
|
return new JsonPrimitive(luaValue.tojstring());
|
||||||
@@ -193,7 +204,8 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
if (value == null) continue;
|
if (value == null) continue;
|
||||||
try {
|
try {
|
||||||
jsonObject.add(key.checkjstring(), value);
|
jsonObject.add(key.checkjstring(), value);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
@@ -249,7 +261,9 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
});
|
});
|
||||||
storageLib.set("global", global);
|
storageLib.set("global", global);
|
||||||
|
|
||||||
@@ -294,7 +308,9 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
});
|
});
|
||||||
storageLib.set("player", playerStorage);
|
storageLib.set("player", playerStorage);
|
||||||
|
|
||||||
@@ -343,7 +359,9 @@ public class StorageLib implements LuaLib, Enable, Disable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
});
|
});
|
||||||
storageLib.set("region", regionStorage);
|
storageLib.set("region", regionStorage);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ public class WorldEditLib implements LuaLib {
|
|||||||
return selection;
|
return selection;
|
||||||
}, o -> {
|
}, o -> {
|
||||||
LuaTable selection = o.checktable();
|
LuaTable selection = o.checktable();
|
||||||
if(selection.length() != 2) {
|
if (selection.length() != 2) {
|
||||||
throw new IllegalArgumentException("selection must have exactly 2 elements");
|
throw new IllegalArgumentException("selection must have exactly 2 elements");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -26,7 +26,9 @@ import org.bukkit.entity.Player;
|
|||||||
public interface BlockDataConfiguration<T extends BlockData> {
|
public interface BlockDataConfiguration<T extends BlockData> {
|
||||||
|
|
||||||
void previous();
|
void previous();
|
||||||
|
|
||||||
void next();
|
void next();
|
||||||
|
|
||||||
SWItem get(Player player);
|
SWItem get(Player player);
|
||||||
|
|
||||||
void apply(T copied, T worldOriginal);
|
void apply(T copied, T worldOriginal);
|
||||||
|
|||||||
+2
-1
@@ -293,8 +293,9 @@ public class SimulatorCursor implements Listener {
|
|||||||
|
|
||||||
if (!player.isSneaking()) {
|
if (!player.isSneaking()) {
|
||||||
pos.setX(pos.getBlockX() + 0.5);
|
pos.setX(pos.getBlockX() + 0.5);
|
||||||
if (face == null || face.getModY() == 0)
|
if (face == null || face.getModY() == 0) {
|
||||||
pos.setY(pos.getBlockY() + 0.0);
|
pos.setY(pos.getBlockY() + 0.0);
|
||||||
|
}
|
||||||
pos.setZ(pos.getBlockZ() + 0.5);
|
pos.setZ(pos.getBlockZ() + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -120,6 +120,10 @@ public abstract class SimulatorElement<T extends SimulatorPhase> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getType();
|
public abstract String getType();
|
||||||
public void saveExtra(YAPIONObject elementObject) {}
|
|
||||||
public void loadExtra(YAPIONObject elementObject) {}
|
public void saveExtra(YAPIONObject elementObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadExtra(YAPIONObject elementObject) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -37,6 +37,10 @@ public abstract class SimulatorPhase {
|
|||||||
protected int order = 0;
|
protected int order = 0;
|
||||||
|
|
||||||
public abstract void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd);
|
public abstract void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd);
|
||||||
public void saveExtra(YAPIONObject phaseObject) {}
|
|
||||||
public void loadExtra(YAPIONObject phaseObject) {}
|
public void saveExtra(YAPIONObject phaseObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadExtra(YAPIONObject phaseObject) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -65,7 +65,9 @@ public final class TNTPhase extends SimulatorPhase {
|
|||||||
@Override
|
@Override
|
||||||
public void accept(World world) {
|
public void accept(World world) {
|
||||||
Location location = position.toLocation(world);
|
Location location = position.toLocation(world);
|
||||||
if (Region.getRegion(location).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) return;
|
if (Region.getRegion(location).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
|
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
|
||||||
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
|
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
|
||||||
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
|
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
|
||||||
|
|||||||
+1
-1
@@ -140,7 +140,7 @@ public class SimulatorExecutor implements Listener {
|
|||||||
private void runActions(List<SimulatorAction> actionsToRun) {
|
private void runActions(List<SimulatorAction> actionsToRun) {
|
||||||
while (!actionsToRun.isEmpty()) {
|
while (!actionsToRun.isEmpty()) {
|
||||||
Collections.shuffle(actionsToRun);
|
Collections.shuffle(actionsToRun);
|
||||||
for (int i = actionsToRun.size() - 1 ; i >= 0; i--) {
|
for (int i = actionsToRun.size() - 1; i >= 0; i--) {
|
||||||
SimulatorAction action = actionsToRun.get(i);
|
SimulatorAction action = actionsToRun.get(i);
|
||||||
action.accept(WORLD);
|
action.accept(WORLD);
|
||||||
action.setCount(action.getCount() - 1);
|
action.setCount(action.getCount() - 1);
|
||||||
|
|||||||
+2
-1
@@ -55,8 +55,9 @@ public class StabGenerator extends StabStep implements Listener {
|
|||||||
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
||||||
if (Region.getRegion(event.getEntity().getLocation()) == data.region) {
|
if (Region.getRegion(event.getEntity().getLocation()) == data.region) {
|
||||||
event.blockList().forEach(block -> {
|
event.blockList().forEach(block -> {
|
||||||
if (!data.region.getTestblockArea().inRegion(block.getLocation(), true))
|
if (!data.region.getTestblockArea().inRegion(block.getLocation(), true)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int component = data.direction.component.apply(block.getLocation().toVector());
|
int component = data.direction.component.apply(block.getLocation().toVector());
|
||||||
destroyedBlocksPerSlice.computeIfAbsent(component, __ -> new HashSet<>())
|
destroyedBlocksPerSlice.computeIfAbsent(component, __ -> new HashSet<>())
|
||||||
.add(block.getLocation());
|
.add(block.getLocation());
|
||||||
|
|||||||
+4
-4
@@ -148,7 +148,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
.allMatch(tntElement -> tntElement.getAlignment().getX() == -1));
|
.allMatch(tntElement -> tntElement.getAlignment().getX() == -1));
|
||||||
inventory.setItem(12, negativXItem);
|
inventory.setItem(12, negativXItem);
|
||||||
|
|
||||||
SWItem positivXItem = new SWItem(Material.STONE_BUTTON, "§7Align§8: §ePositiv X", clickType -> {
|
SWItem positivXItem = new SWItem(Material.STONE_BUTTON, "§7Align§8: §ePositiv X", clickType -> {
|
||||||
simulatorGroup.getElements().stream()
|
simulatorGroup.getElements().stream()
|
||||||
.map(TNTElement.class::cast)
|
.map(TNTElement.class::cast)
|
||||||
.forEach(tntElement -> {
|
.forEach(tntElement -> {
|
||||||
@@ -169,7 +169,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
|
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Relative X", "", Double::parseDouble, number -> {
|
new SimulatorAnvilGui<>(player, "Relative X", "", Double::parseDouble, number -> {
|
||||||
if(!allTNT){
|
if (!allTNT) {
|
||||||
number = (double) Math.round(number);
|
number = (double) Math.round(number);
|
||||||
}
|
}
|
||||||
simulatorGroup.move(number, 0, 0);
|
simulatorGroup.move(number, 0, 0);
|
||||||
@@ -189,7 +189,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
|
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Relative Y", "", Double::parseDouble, number -> {
|
new SimulatorAnvilGui<>(player, "Relative Y", "", Double::parseDouble, number -> {
|
||||||
if(!allTNT){
|
if (!allTNT) {
|
||||||
number = (double) Math.round(number);
|
number = (double) Math.round(number);
|
||||||
}
|
}
|
||||||
simulatorGroup.move(0, number, 0);
|
simulatorGroup.move(0, number, 0);
|
||||||
@@ -209,7 +209,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
||||||
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
|
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Relative Z", "", Double::parseDouble, number -> {
|
new SimulatorAnvilGui<>(player, "Relative Z", "", Double::parseDouble, number -> {
|
||||||
if(!allTNT){
|
if (!allTNT) {
|
||||||
number = (double) Math.round(number);
|
number = (double) Math.round(number);
|
||||||
}
|
}
|
||||||
simulatorGroup.move(0, 0, number);
|
simulatorGroup.move(0, 0, number);
|
||||||
|
|||||||
+1
-1
@@ -148,7 +148,7 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
|
|||||||
|
|
||||||
Supplier<Integer> getter = observerPhase::getTickOffset;
|
Supplier<Integer> getter = observerPhase::getTickOffset;
|
||||||
Consumer<Integer> setter = observerPhase::setTickOffset;
|
Consumer<Integer> setter = observerPhase::setTickOffset;
|
||||||
return new SWItem[] {
|
return new SWItem[]{
|
||||||
new SWItem(getter.get() < max ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(getter.get() < max ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
|
|||||||
+1
-1
@@ -93,7 +93,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, new SWItem(Material.LIME_DYE, "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
|
|||||||
+1
-1
@@ -163,7 +163,7 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
|
|||||||
|
|
||||||
Supplier<Integer> getter = redstoneSubPhase.place ? redstoneSubPhase.phase::getTickOffset : redstoneSubPhase.phase::getLifetime;
|
Supplier<Integer> getter = redstoneSubPhase.place ? redstoneSubPhase.phase::getTickOffset : redstoneSubPhase.phase::getLifetime;
|
||||||
Consumer<Integer> setter = redstoneSubPhase.place ? redstoneSubPhase.phase::setTickOffset : redstoneSubPhase.phase::setLifetime;
|
Consumer<Integer> setter = redstoneSubPhase.place ? redstoneSubPhase.phase::setTickOffset : redstoneSubPhase.phase::setLifetime;
|
||||||
return new SWItem[] {
|
return new SWItem[]{
|
||||||
new SWItem(getter.get() < max ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(getter.get() < max ? Material.LIME_DYE : Material.GRAY_DYE, "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
if (clickType == ClickType.DOUBLE_CLICK) return;
|
if (clickType == ClickType.DOUBLE_CLICK) return;
|
||||||
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
|
|||||||
+2
-2
@@ -130,8 +130,8 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
negativXItem.setEnchanted(tnt.getAlignment().getX() == -1);
|
negativXItem.setEnchanted(tnt.getAlignment().getX() == -1);
|
||||||
inventory.setItem(12, negativXItem);
|
inventory.setItem(12, negativXItem);
|
||||||
|
|
||||||
SWItem positivXItem = new SWItem(Material.STONE_BUTTON, "§7Align§8: §ePositiv X", clickType -> {
|
SWItem positivXItem = new SWItem(Material.STONE_BUTTON, "§7Align§8: §ePositiv X", clickType -> {
|
||||||
if(tnt.getAlignment().getX() != 1) tnt.alignX(1);
|
if (tnt.getAlignment().getX() != 1) tnt.alignX(1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
});
|
});
|
||||||
positivXItem.setEnchanted(tnt.getAlignment().getX() == 1);
|
positivXItem.setEnchanted(tnt.getAlignment().getX() == 1);
|
||||||
|
|||||||
+7
-3
@@ -33,6 +33,7 @@ import java.util.*;
|
|||||||
public class LaufbauSettings {
|
public class LaufbauSettings {
|
||||||
|
|
||||||
private static Map<Pair<Material, String>, List<BlockBoundingBox>> groupMap = new LinkedHashMap<>();
|
private static Map<Pair<Material, String>, List<BlockBoundingBox>> groupMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
BlockBoundingBox.elements.forEach(blockBoundingBox -> {
|
BlockBoundingBox.elements.forEach(blockBoundingBox -> {
|
||||||
if (blockBoundingBox.getSwItem() == null) return;
|
if (blockBoundingBox.getSwItem() == null) return;
|
||||||
@@ -115,12 +116,15 @@ public class LaufbauSettings {
|
|||||||
} else {
|
} else {
|
||||||
long count = blockBoundingBoxes.stream().filter(bb -> LaufbauUtils.isDeactivated(p, bb)).count();
|
long count = blockBoundingBoxes.stream().filter(bb -> LaufbauUtils.isDeactivated(p, bb)).count();
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (count == blockBoundingBoxes.size()) {
|
if (count == blockBoundingBoxes.size()) {
|
||||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_INACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_INACTIVE", p), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_MIXED", p, blockBoundingBoxes.size() - count, blockBoundingBoxes.size()), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {});
|
return new SWItem(material, BauSystem.MESSAGE.parse(group, p), Arrays.asList("", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_MIXED", p, blockBoundingBoxes.size() - count, blockBoundingBoxes.size()), "", BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_ADVANCED", p), BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_TOGGLE", p)), false, clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ public class CandleBoundingBox implements BoundingBoxLoader {
|
|||||||
Candle candle = (Candle) Material.CYAN_CANDLE.createBlockData();
|
Candle candle = (Candle) Material.CYAN_CANDLE.createBlockData();
|
||||||
candle.setCandles(1);
|
candle.setCandles(1);
|
||||||
List<Cuboid> cuboidList = new ArrayList<>();
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
cuboidList.add(pixelCuboid(7, 0,7, 2, 6, 2));
|
cuboidList.add(pixelCuboid(7, 0, 7, 2, 6, 2));
|
||||||
new BlockBoundingBox(candle, cuboidList, createItem("LAUFBAU_BLOCK_CANDLE", Material.CYAN_CANDLE, "LAUFBAU_COUNT_1"));
|
new BlockBoundingBox(candle, cuboidList, createItem("LAUFBAU_BLOCK_CANDLE", Material.CYAN_CANDLE, "LAUFBAU_COUNT_1"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -87,8 +87,9 @@ public class ProcessingTracesState implements LaufbauState {
|
|||||||
|
|
||||||
TNTPoint current = TNTPoints.remove(0);
|
TNTPoint current = TNTPoints.remove(0);
|
||||||
if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return;
|
if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return;
|
||||||
if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1))))
|
if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1)))) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Location location = current.getLocation();
|
Location location = current.getLocation();
|
||||||
if (current.getPrevious().isPresent()) {
|
if (current.getPrevious().isPresent()) {
|
||||||
|
|||||||
+1
@@ -40,6 +40,7 @@ import java.util.*;
|
|||||||
public class Panzern {
|
public class Panzern {
|
||||||
|
|
||||||
private static List<PanzernAlgorithm> panzernAlgorithmList = new ArrayList<>();
|
private static List<PanzernAlgorithm> panzernAlgorithmList = new ArrayList<>();
|
||||||
|
|
||||||
public static void add(PanzernAlgorithm panzernAlgorithm) {
|
public static void add(PanzernAlgorithm panzernAlgorithm) {
|
||||||
panzernAlgorithmList.add(panzernAlgorithm);
|
panzernAlgorithmList.add(panzernAlgorithm);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -121,7 +121,7 @@ public class PanzernCommand extends SWCommand {
|
|||||||
if (!material.isBlock()) {
|
if (!material.isBlock()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (material.name().contains("STAIRS") || material.name().contains("SLAB") || material.name().contains("GLASS")) {
|
if (material.name().contains("STAIRS") || material.name().contains("SLAB") || material.name().contains("GLASS")) {
|
||||||
strings.add(material.name().toLowerCase());
|
strings.add(material.name().toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -86,7 +86,7 @@ public class SmartPlaceListener implements Listener {
|
|||||||
|
|
||||||
public SmartPlaceListener() {
|
public SmartPlaceListener() {
|
||||||
TinyProtocol.instance.addFilter(ServerboundUseItemOnPacket.class, (player, packet) -> {
|
TinyProtocol.instance.addFilter(ServerboundUseItemOnPacket.class, (player, packet) -> {
|
||||||
if(!Permission.BUILD.hasPermission(player)) return packet;
|
if (!Permission.BUILD.hasPermission(player)) return packet;
|
||||||
if (!Config.getInstance().get(player).getPlainValueOrDefault("smartPlace", false)) return packet;
|
if (!Config.getInstance().get(player).getPlainValueOrDefault("smartPlace", false)) return packet;
|
||||||
RayTraceResult rayTraceResult = player.rayTraceBlocks(6);
|
RayTraceResult rayTraceResult = player.rayTraceBlocks(6);
|
||||||
Block block = rayTraceResult != null ? rayTraceResult.getHitBlock() : null;
|
Block block = rayTraceResult != null ? rayTraceResult.getHitBlock() : null;
|
||||||
@@ -126,7 +126,7 @@ public class SmartPlaceListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
||||||
WAS_EXECUTED.add(event.getPlayer());
|
WAS_EXECUTED.add(event.getPlayer());
|
||||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ public class BlockCounter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage(Player player, int count, int tntCount, long tick, long lastTick) {
|
public String getMessage(Player player, int count, int tntCount, long tick, long lastTick) {
|
||||||
if(!Permission.BUILD.hasPermission(player)) return null;
|
if (!Permission.BUILD.hasPermission(player)) return null;
|
||||||
|
|
||||||
double countPerTNT = (double) count / tntCount;
|
double countPerTNT = (double) count / tntCount;
|
||||||
double countPerTick = (double) count / Math.max((lastTick - tick), 1);
|
double countPerTick = (double) count / Math.max((lastTick - tick), 1);
|
||||||
|
|||||||
@@ -144,8 +144,9 @@ public class Trace {
|
|||||||
entityServer = new REntityServer();
|
entityServer = new REntityServer();
|
||||||
entityServer.addPlayer(player);
|
entityServer.addPlayer(player);
|
||||||
entityServer.setCallback((p, rEntity, entityAction) -> {
|
entityServer.setCallback((p, rEntity, entityAction) -> {
|
||||||
if (entityAction != REntityServer.EntityAction.INTERACT)
|
if (entityAction != REntityServer.EntityAction.INTERACT) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (rEntity instanceof TraceEntity) {
|
if (rEntity instanceof TraceEntity) {
|
||||||
((TraceEntity) rEntity).printIntoChat(p);
|
((TraceEntity) rEntity).printIntoChat(p);
|
||||||
}
|
}
|
||||||
@@ -167,8 +168,9 @@ public class Trace {
|
|||||||
REntityServer newEntityServer = new REntityServer();
|
REntityServer newEntityServer = new REntityServer();
|
||||||
newEntityServer.addPlayer(k);
|
newEntityServer.addPlayer(k);
|
||||||
newEntityServer.setCallback((p, rEntity, entityAction) -> {
|
newEntityServer.setCallback((p, rEntity, entityAction) -> {
|
||||||
if (entityAction != REntityServer.EntityAction.INTERACT)
|
if (entityAction != REntityServer.EntityAction.INTERACT) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (rEntity instanceof TraceEntity) {
|
if (rEntity instanceof TraceEntity) {
|
||||||
((TraceEntity) rEntity).printIntoChat(p);
|
((TraceEntity) rEntity).printIntoChat(p);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-5
@@ -46,12 +46,10 @@ public class TraceManager implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
if (!tracesFolder.exists())
|
if (!tracesFolder.exists()) tracesFolder.mkdir();
|
||||||
tracesFolder.mkdir();
|
|
||||||
|
|
||||||
File[] traceFiles = tracesFolder.listFiles();
|
File[] traceFiles = tracesFolder.listFiles();
|
||||||
if (traceFiles == null)
|
if (traceFiles == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
boolean hasMetaFiles = false;
|
boolean hasMetaFiles = false;
|
||||||
for (File traceFile : traceFiles) {
|
for (File traceFile : traceFiles) {
|
||||||
@@ -152,7 +150,8 @@ public class TraceManager implements Listener {
|
|||||||
.map(Map.Entry::getKey)
|
.map(Map.Entry::getKey)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (traceId == null) throw new RuntimeException("Trace not found while trying to remove see (c978eb98-b0b2-4009-91d8-acfa34e2831a)");
|
if (traceId == null)
|
||||||
|
throw new RuntimeException("Trace not found while trying to remove see (c978eb98-b0b2-4009-91d8-acfa34e2831a)");
|
||||||
traces.remove(traceId);
|
traces.remove(traceId);
|
||||||
trace.hide();
|
trace.hide();
|
||||||
trace.getRecordsSaveFile().delete();
|
trace.getRecordsSaveFile().delete();
|
||||||
|
|||||||
+3
-1
@@ -70,7 +70,9 @@ public class TraceEntity extends RFallingBlockEntity {
|
|||||||
* @param player the player the message should be printed for
|
* @param player the player the message should be printed for
|
||||||
*/
|
*/
|
||||||
public void printIntoChat(Player player) {
|
public void printIntoChat(Player player) {
|
||||||
if (!Config.getInstance().get(player).getOrSetDefault(TNT_CLICK_DETAILS, new YAPIONValue<>(true)).asBoolean().orElse(true)) return;
|
if (!Config.getInstance().get(player).getOrSetDefault(TNT_CLICK_DETAILS, new YAPIONValue<>(true)).asBoolean().orElse(true)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
TNTPoint representative = records.get(0);
|
TNTPoint representative = records.get(0);
|
||||||
|
|
||||||
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player);
|
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player);
|
||||||
|
|||||||
+2
-3
@@ -102,8 +102,7 @@ public abstract class ViewFlag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasMicromotion)
|
if (!hasMicromotion) toRemove.add(uniqueRecord);
|
||||||
toRemove.add(uniqueRecord);
|
|
||||||
|
|
||||||
seen.add(uniqueRecord.getTntId());
|
seen.add(uniqueRecord.getTntId());
|
||||||
}
|
}
|
||||||
@@ -126,7 +125,7 @@ public abstract class ViewFlag {
|
|||||||
|
|
||||||
TNTPoint previous = prev.get();
|
TNTPoint previous = prev.get();
|
||||||
Location delta = representative.getLocation().clone().subtract(previous.getLocation());
|
Location delta = representative.getLocation().clone().subtract(previous.getLocation());
|
||||||
Vector previousVelocity = previous.isAfterFirstExplosion() ? previous.getVelocity() : delta.toVector().clone().divide(DRAG_FACTOR).subtract(GRAVATY);
|
Vector previousVelocity = previous.isAfterFirstExplosion() ? previous.getVelocity() : delta.toVector().clone().divide(DRAG_FACTOR).subtract(GRAVATY);
|
||||||
|
|
||||||
Location yLocation = previous.getLocation().clone().add(0, delta.getY(), 0);
|
Location yLocation = previous.getLocation().clone().add(0, delta.getY(), 0);
|
||||||
if (yLocation.distanceSquared(representative.getLocation()) >= 1.0 / 256.0 && yLocation.distanceSquared(previous.getLocation()) >= 1.0 / 256.0) {
|
if (yLocation.distanceSquared(representative.getLocation()) >= 1.0 / 256.0 && yLocation.distanceSquared(previous.getLocation()) >= 1.0 / 256.0) {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class BindCommand extends SWCommand implements Listener {
|
|||||||
try {
|
try {
|
||||||
knownCommandsField = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
knownCommandsField = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||||
knownCommandsField.setAccessible(true);
|
knownCommandsField.setAccessible(true);
|
||||||
commandMap = (CommandMap)knownCommandsField.get(Bukkit.getServer());
|
commandMap = (CommandMap) knownCommandsField.get(Bukkit.getServer());
|
||||||
} catch (IllegalAccessException | NoSuchFieldException var2) {
|
} catch (IllegalAccessException | NoSuchFieldException var2) {
|
||||||
Bukkit.shutdown();
|
Bukkit.shutdown();
|
||||||
throw new SecurityException("Oh shit. Commands cannot be registered.", var2);
|
throw new SecurityException("Oh shit. Commands cannot be registered.", var2);
|
||||||
@@ -123,7 +123,7 @@ public class BindCommand extends SWCommand implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (!event.hasItem()) return;
|
if (!event.hasItem()) return;
|
||||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
ItemStack itemStack = event.getItem();
|
ItemStack itemStack = event.getItem();
|
||||||
ItemMeta meta = itemStack.getItemMeta();
|
ItemMeta meta = itemStack.getItemMeta();
|
||||||
if (meta == null) {
|
if (meta == null) {
|
||||||
|
|||||||
+20
-20
@@ -28,33 +28,33 @@ import org.bukkit.entity.Player;
|
|||||||
@Linked
|
@Linked
|
||||||
public class GamemodeCommand extends SWCommand {
|
public class GamemodeCommand extends SWCommand {
|
||||||
|
|
||||||
public GamemodeCommand() {
|
public GamemodeCommand() {
|
||||||
super("gamemode", "gm", "g");
|
super("gamemode", "gm", "g");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void help(final Player p, final String... args) {
|
public void help(final Player p, final String... args) {
|
||||||
BauSystem.MESSAGE.sendPrefixless("OTHER_GAMEMODE_UNKNOWN", p);
|
BauSystem.MESSAGE.sendPrefixless("OTHER_GAMEMODE_UNKNOWN", p);
|
||||||
BauSystem.MESSAGE.sendPrefixless("OTHER_GAMEMODE_POSSIBLE", p);
|
BauSystem.MESSAGE.sendPrefixless("OTHER_GAMEMODE_POSSIBLE", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void genericCommand(final Player p) {
|
public void genericCommand(final Player p) {
|
||||||
SWPlayer swPlayer = SWPlayer.of(p);
|
SWPlayer swPlayer = SWPlayer.of(p);
|
||||||
if (swPlayer.hasComponent(NoClipCommand.NoClipData.class)) {
|
if (swPlayer.hasComponent(NoClipCommand.NoClipData.class)) {
|
||||||
swPlayer.removeComponent(NoClipCommand.NoClipData.class);
|
swPlayer.removeComponent(NoClipCommand.NoClipData.class);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (p.getGameMode() == GameMode.CREATIVE) {
|
if (p.getGameMode() == GameMode.CREATIVE) {
|
||||||
p.setGameMode(GameMode.SPECTATOR);
|
p.setGameMode(GameMode.SPECTATOR);
|
||||||
} else {
|
} else {
|
||||||
p.setGameMode(GameMode.CREATIVE);
|
p.setGameMode(GameMode.CREATIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void gamemodeCommand(final Player p, final GameMode gameMode) {
|
public void gamemodeCommand(final Player p, final GameMode gameMode) {
|
||||||
SWPlayer.of(p).removeComponent(NoClipCommand.NoClipData.class);
|
SWPlayer.of(p).removeComponent(NoClipCommand.NoClipData.class);
|
||||||
p.setGameMode(gameMode);
|
p.setGameMode(gameMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -104,6 +104,7 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<String, BiConsumer<SearchParameter, SearchType>> elements = new HashMap<>();
|
private static final Map<String, BiConsumer<SearchParameter, SearchType>> elements = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
elements.put("-transparent", (search, searchType) -> search.transparent = searchType);
|
elements.put("-transparent", (search, searchType) -> search.transparent = searchType);
|
||||||
elements.put("-solid", (search, searchType) -> search.solid = searchType);
|
elements.put("-solid", (search, searchType) -> search.solid = searchType);
|
||||||
@@ -121,7 +122,7 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
SearchParameter searchParameter = SWPlayer.of(p).getComponentOrDefault(SearchParameter.class, SearchParameter::new);
|
SearchParameter searchParameter = SWPlayer.of(p).getComponentOrDefault(SearchParameter.class, SearchParameter::new);
|
||||||
for (String s : searches) {
|
for (String s : searches) {
|
||||||
boolean has = false;
|
boolean has = false;
|
||||||
for (Map.Entry<String, BiConsumer<SearchParameter, SearchType>> element: elements.entrySet()) {
|
for (Map.Entry<String, BiConsumer<SearchParameter, SearchType>> element : elements.entrySet()) {
|
||||||
if (s.startsWith(element.getKey() + ":")) {
|
if (s.startsWith(element.getKey() + ":")) {
|
||||||
element.getValue().accept(searchParameter, SearchType.valueOf(s.substring(element.getKey().length() + 1).toUpperCase()));
|
element.getValue().accept(searchParameter, SearchType.valueOf(s.substring(element.getKey().length() + 1).toUpperCase()));
|
||||||
has = true;
|
has = true;
|
||||||
|
|||||||
+1
-1
@@ -156,7 +156,7 @@ public class MaterialLazyInit {
|
|||||||
} else if (string.startsWith(">=")) {
|
} else if (string.startsWith(">=")) {
|
||||||
if (blastResistance < Double.parseDouble(string.substring(2))) return false;
|
if (blastResistance < Double.parseDouble(string.substring(2))) return false;
|
||||||
} else if (string.startsWith("<=")) {
|
} else if (string.startsWith("<=")) {
|
||||||
if (blastResistance > Double.parseDouble(string.substring(2)))return false;
|
if (blastResistance > Double.parseDouble(string.substring(2))) return false;
|
||||||
} else if (string.startsWith(">")) {
|
} else if (string.startsWith(">")) {
|
||||||
if (blastResistance <= Double.parseDouble(string.substring(1))) return false;
|
if (blastResistance <= Double.parseDouble(string.substring(1))) return false;
|
||||||
} else if (string.startsWith("<")) {
|
} else if (string.startsWith("<")) {
|
||||||
|
|||||||
+2
-1
@@ -282,8 +282,9 @@ public class PistonCalculator implements Listener {
|
|||||||
immovableBlocks.add(block.getLocation());
|
immovableBlocks.add(block.getLocation());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (facing != direction && (block.equals(origin) || block.getRelative(facing.getOppositeFace()).equals(origin)))
|
if (facing != direction && (block.equals(origin) || block.getRelative(facing.getOppositeFace()).equals(origin))) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (!movedBlocks.contains(block.getLocation())) toCalc.add(block);
|
if (!movedBlocks.contains(block.getLocation())) toCalc.add(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -60,7 +60,9 @@ public class TNTClickListener extends SWCommand implements Listener {
|
|||||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
if (event.getHand() != EquipmentSlot.HAND) return;
|
if (event.getHand() != EquipmentSlot.HAND) return;
|
||||||
if (!Config.getInstance().get(event.getPlayer()).getOrSetDefault(TNT_CLICK_DETAILS, new YAPIONValue<>(true)).asBoolean().orElse(true)) return;
|
if (!Config.getInstance().get(event.getPlayer()).getOrSetDefault(TNT_CLICK_DETAILS, new YAPIONValue<>(true)).asBoolean().orElse(true)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Entity entity = event.getRightClicked();
|
Entity entity = event.getRightClicked();
|
||||||
if (event.getRightClicked() instanceof TNTPrimed) {
|
if (event.getRightClicked() instanceof TNTPrimed) {
|
||||||
|
|||||||
+2
-1
@@ -41,7 +41,8 @@ public class GamemodeBauGuiItem extends BauGuiItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
return new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("OTHER_ITEMS_GAMEMODE_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("OTHER_ITEMS_GAMEMODE_LORE_1", player), BauSystem.MESSAGE.parse("OTHER_ITEMS_GAMEMODE_LORE_2", player)), false, clickType -> {}).getItemStack();
|
return new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("OTHER_ITEMS_GAMEMODE_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("OTHER_ITEMS_GAMEMODE_LORE_1", player), BauSystem.MESSAGE.parse("OTHER_ITEMS_GAMEMODE_LORE_2", player)), false, clickType -> {
|
||||||
|
}).getItemStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-1
@@ -46,7 +46,8 @@ public class KillAllBauGuiItem extends BauGuiItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
return new SWItem(Material.LAVA_BUCKET, BauSystem.MESSAGE.parse("OTHER_ITEMS_KILLALL_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("OTHER_ITEMS_KILLALL_LORE_1", player), BauSystem.MESSAGE.parse("OTHER_ITEMS_KILLALL_LORE_2", player)), false, clickType -> {}).getItemStack();
|
return new SWItem(Material.LAVA_BUCKET, BauSystem.MESSAGE.parse("OTHER_ITEMS_KILLALL_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("OTHER_ITEMS_KILLALL_LORE_1", player), BauSystem.MESSAGE.parse("OTHER_ITEMS_KILLALL_LORE_2", player)), false, clickType -> {
|
||||||
|
}).getItemStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+6
-3
@@ -38,16 +38,19 @@ public class NavWandBauGuiItem extends BauGuiItem {
|
|||||||
super(27);
|
super(27);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Permission permission() {
|
@Override
|
||||||
|
public Permission permission() {
|
||||||
return Permission.MEMBER;
|
return Permission.MEMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public ItemStack getItem(Player player) {
|
@Override
|
||||||
|
public ItemStack getItem(Player player) {
|
||||||
return new SWItem(Material.COMPASS, BauSystem.MESSAGE.parse("NAVIGATION_WAND", player), Arrays.asList(BauSystem.MESSAGE.parse("NAVIGATION_WAND_LEFT_CLICK", player), BauSystem.MESSAGE.parse("NAVIGATION_WAND_RIGHT_CLICK", player)), false, clickType -> {
|
return new SWItem(Material.COMPASS, BauSystem.MESSAGE.parse("NAVIGATION_WAND", player), Arrays.asList(BauSystem.MESSAGE.parse("NAVIGATION_WAND_LEFT_CLICK", player), BauSystem.MESSAGE.parse("NAVIGATION_WAND_RIGHT_CLICK", player)), false, clickType -> {
|
||||||
}).getItemStack();
|
}).getItemStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean click(ClickType click, Player p) {
|
@Override
|
||||||
|
public boolean click(ClickType click, Player p) {
|
||||||
p.performCommand("/wand -n");
|
p.performCommand("/wand -n");
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ public class SkullBauGuiItem extends BauGuiItem {
|
|||||||
@Override
|
@Override
|
||||||
public boolean click(ClickType click, Player p) {
|
public boolean click(ClickType click, Player p) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
SWAnvilInv inv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("ANVIL_INV_NAME",p));
|
SWAnvilInv inv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("ANVIL_INV_NAME", p));
|
||||||
inv.setItem(Material.NAME_TAG);
|
inv.setItem(Material.NAME_TAG);
|
||||||
inv.setCallback(s -> p.performCommand("skull " + s));
|
inv.setCallback(s -> p.performCommand("skull " + s));
|
||||||
inv.open();
|
inv.open();
|
||||||
|
|||||||
+10
-7
@@ -41,34 +41,37 @@ public class AFKStopperListener implements Listener {
|
|||||||
public AFKStopperListener() {
|
public AFKStopperListener() {
|
||||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
if(currentTime - lastMovementTime > 10*60000) { // 10 Minutes
|
if (currentTime - lastMovementTime > 10 * 60000) { // 10 Minutes
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
p.kickPlayer(BauSystem.MESSAGE.parse("AFK_KICK_MESSAGE", p));
|
p.kickPlayer(BauSystem.MESSAGE.parse("AFK_KICK_MESSAGE", p));
|
||||||
} else if(currentTime - lastMovementTime > 9*60000)
|
}
|
||||||
|
} else if (currentTime - lastMovementTime > 9 * 60000) {
|
||||||
BauSystem.MESSAGE.broadcast("AFK_WARNING_MESSAGE");
|
BauSystem.MESSAGE.broadcast("AFK_WARNING_MESSAGE");
|
||||||
|
}
|
||||||
}, 1200, 1200); //every minute
|
}, 1200, 1200); //every minute
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
Location to = event.getTo();
|
Location to = event.getTo();
|
||||||
if (to == null)
|
if (to == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Location from = event.getFrom();
|
Location from = event.getFrom();
|
||||||
if (from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw())
|
if (from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw())
|
||||||
lastMovementTime = System.currentTimeMillis();
|
lastMovementTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST) //Potential fix for potential race condition with WE axe spontaneously not working
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
//Potential fix for potential race condition with WE axe spontaneously not working
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
event.getPlayer().setOp(true);
|
event.getPlayer().setOp(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer())))
|
if (Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer()))) {
|
||||||
CheckpointUtils.freeze();
|
CheckpointUtils.freeze();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|||||||
+3
-3
@@ -63,7 +63,7 @@ public class BauMemberUpdate extends PacketHandler implements Listener {
|
|||||||
if (!SPECTATORS.contains(player)) {
|
if (!SPECTATORS.contains(player)) {
|
||||||
SPECTATORS.add(player);
|
SPECTATORS.add(player);
|
||||||
newSpectator.add(player);
|
newSpectator.add(player);
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false,false, false));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false, false, false));
|
||||||
showSpectatorNotice(player);
|
showSpectatorNotice(player);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -82,7 +82,7 @@ public class BauMemberUpdate extends PacketHandler implements Listener {
|
|||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||||
SPECTATORS.add(event.getPlayer());
|
SPECTATORS.add(event.getPlayer());
|
||||||
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false,false, false));
|
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false, false, false));
|
||||||
showSpectatorNotice(event.getPlayer());
|
showSpectatorNotice(event.getPlayer());
|
||||||
} else {
|
} else {
|
||||||
event.getPlayer().removePotionEffect(PotionEffectType.GLOWING);
|
event.getPlayer().removePotionEffect(PotionEffectType.GLOWING);
|
||||||
@@ -123,7 +123,7 @@ public class BauMemberUpdate extends PacketHandler implements Listener {
|
|||||||
public void onPlayerItemConsume(PlayerItemConsumeEvent event) {
|
public void onPlayerItemConsume(PlayerItemConsumeEvent event) {
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
if (SPECTATORS.contains(event.getPlayer())) {
|
if (SPECTATORS.contains(event.getPlayer())) {
|
||||||
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false,false, false));
|
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false, false, false));
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ public class ItemFrameListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Permission.BUILD.hasPermission((Player) event.getDamager())) return;
|
if (!Permission.BUILD.hasPermission((Player) event.getDamager())) return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
ItemFrame itemFrame = (ItemFrame) event.getEntity();
|
ItemFrame itemFrame = (ItemFrame) event.getEntity();
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public class KickallCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register(description = "KICKALL_HELP")
|
@Register(description = "KICKALL_HELP")
|
||||||
public void genericCommand(Player player) {
|
public void genericCommand(Player player) {
|
||||||
if(!Permission.OWNER.hasPermission(player)) return;
|
if (!Permission.OWNER.hasPermission(player)) return;
|
||||||
|
|
||||||
Bukkit.getOnlinePlayers().forEach(p -> {
|
Bukkit.getOnlinePlayers().forEach(p -> {
|
||||||
if (!bauServer.getOwner().equals(p.getUniqueId())) p.kickPlayer("");
|
if (!bauServer.getOwner().equals(p.getUniqueId())) p.kickPlayer("");
|
||||||
|
|||||||
@@ -105,8 +105,9 @@ public class SignEdit implements Listener {
|
|||||||
Bukkit.getScheduler().runTask(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTask(BauSystem.getInstance(), () -> {
|
||||||
ServerLevel serverLevel = ((CraftWorld) player.getWorld()).getHandle();
|
ServerLevel serverLevel = ((CraftWorld) player.getWorld()).getHandle();
|
||||||
Block signLoc = CraftBlock.at(serverLevel, o.getPos());
|
Block signLoc = CraftBlock.at(serverLevel, o.getPos());
|
||||||
if (!signLoc.getType().name().contains("SIGN"))
|
if (!signLoc.getType().name().contains("SIGN")) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String[] lines = o.getLines();
|
String[] lines = o.getLines();
|
||||||
Sign sign = ((Sign) signLoc.getState());
|
Sign sign = ((Sign) signLoc.getState());
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ public class SignListener implements Listener {
|
|||||||
public void onSignChange(SignChangeEvent event) {
|
public void onSignChange(SignChangeEvent event) {
|
||||||
for (int i = 0; i <= 3; ++i) {
|
for (int i = 0; i <= 3; ++i) {
|
||||||
String line = event.getLine(i);
|
String line = event.getLine(i);
|
||||||
if (line == null)
|
if (line == null) continue;
|
||||||
continue;
|
|
||||||
line = ChatColor.translateAlternateColorCodes('&', line);
|
line = ChatColor.translateAlternateColorCodes('&', line);
|
||||||
event.setLine(i, line);
|
event.setLine(i, line);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ public class WorldEditSelectionSaver implements Listener {
|
|||||||
private File WORLD_EDIT_SELECTIONS = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "world_edit_selections");
|
private File WORLD_EDIT_SELECTIONS = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "world_edit_selections");
|
||||||
|
|
||||||
{
|
{
|
||||||
WORLD_EDIT_SELECTIONS.mkdir();
|
WORLD_EDIT_SELECTIONS.mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|||||||
+1
@@ -51,6 +51,7 @@ public class ColorReplaceCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Set<String> types = new HashSet<>();
|
private Set<String> types = new HashSet<>();
|
||||||
|
|
||||||
{
|
{
|
||||||
WorldEditListener.addOtherCommand("//colorreplace");
|
WorldEditListener.addOtherCommand("//colorreplace");
|
||||||
WorldEditListener.addOtherCommand("//cr");
|
WorldEditListener.addOtherCommand("//cr");
|
||||||
|
|||||||
@@ -34,49 +34,49 @@ import org.bukkit.entity.Player;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class Point {
|
public class Point {
|
||||||
|
|
||||||
public static final Point ZERO = new Point(0, 0, 0);
|
public static final Point ZERO = new Point(0, 0, 0);
|
||||||
|
|
||||||
private final int x;
|
private final int x;
|
||||||
private final int y;
|
private final int y;
|
||||||
private final int z;
|
private final int z;
|
||||||
|
|
||||||
public static Point fromLocation(final Location location) {
|
public static Point fromLocation(final Location location) {
|
||||||
return new Point(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
return new Point(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Point fromBlockVector3(final BlockVector3 blockVector3) {
|
public static Point fromBlockVector3(final BlockVector3 blockVector3) {
|
||||||
return new Point(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ());
|
return new Point(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point add(int x, int y, int z) {
|
public Point add(int x, int y, int z) {
|
||||||
return new Point(this.x + x, this.y + y, this.z + z);
|
return new Point(this.x + x, this.y + y, this.z + z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point subtract(int x, int y, int z) {
|
public Point subtract(int x, int y, int z) {
|
||||||
return new Point(this.x - x, this.y - y, this.z - z);
|
return new Point(this.x - x, this.y - y, this.z - z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point divide(int factor) {
|
public Point divide(int factor) {
|
||||||
return new Point(x / factor, y / factor, z / factor);
|
return new Point(x / factor, y / factor, z / factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location toLocation(World world) {
|
public Location toLocation(World world) {
|
||||||
return new Location(world, x, y, z);
|
return new Location(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location toLocation(World world, double dx, double dy, double dz) {
|
public Location toLocation(World world, double dx, double dy, double dz) {
|
||||||
return new Location(world, x + dx, y + dy, z + dz);
|
return new Location(world, x + dx, y + dy, z + dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location toLocation(Player player) {
|
public Location toLocation(Player player) {
|
||||||
return new Location(player.getWorld(), x, y, z, player.getLocation().getYaw(), player.getLocation().getPitch());
|
return new Location(player.getWorld(), x, y, z, player.getLocation().getYaw(), player.getLocation().getPitch());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location toLocation(Player player, double dx, double dy, double dz) {
|
public Location toLocation(Player player, double dx, double dy, double dz) {
|
||||||
return new Location(player.getWorld(), x + dx, y + dy, z + dz, player.getLocation().getYaw(), player.getLocation().getPitch());
|
return new Location(player.getWorld(), x + dx, y + dy, z + dz, player.getLocation().getYaw(), player.getLocation().getPitch());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockVector3 toBlockVector3() {
|
public BlockVector3 toBlockVector3() {
|
||||||
return BlockVector3.at(this.x, this.y, this.z);
|
return BlockVector3.at(this.x, this.y, this.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,32 +29,32 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum ChangedMode implements Flag.Value<ChangedMode> {
|
public enum ChangedMode implements Flag.Value<ChangedMode> {
|
||||||
|
|
||||||
NO_CHANGE("FLAG_CHANGED_NO_CHANGE", false),
|
NO_CHANGE("FLAG_CHANGED_NO_CHANGE", false),
|
||||||
HAS_CHANGE("FLAG_CHANGED_HAS_CHANGE", true);
|
HAS_CHANGE("FLAG_CHANGED_HAS_CHANGE", true);
|
||||||
|
|
||||||
private static ChangedMode[] values;
|
private static ChangedMode[] values;
|
||||||
private final String chatValue;
|
private final String chatValue;
|
||||||
private final Boolean changed;
|
private final Boolean changed;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChangedMode[] getValues() {
|
public ChangedMode[] getValues() {
|
||||||
if (ChangedMode.values == null) {
|
if (ChangedMode.values == null) {
|
||||||
ChangedMode.values = ChangedMode.values();
|
ChangedMode.values = ChangedMode.values();
|
||||||
}
|
}
|
||||||
return ChangedMode.values;
|
return ChangedMode.values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChangedMode getValue() {
|
public ChangedMode getValue() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChangedMode getValueOf(final String name) {
|
public ChangedMode getValueOf(final String name) {
|
||||||
try {
|
try {
|
||||||
return ChangedMode.valueOf(name.toUpperCase());
|
return ChangedMode.valueOf(name.toUpperCase());
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
return NO_CHANGE;
|
return NO_CHANGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,34 +29,34 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum FireMode implements Flag.Value<FireMode> {
|
public enum FireMode implements Flag.Value<FireMode> {
|
||||||
|
|
||||||
ALLOW("FLAG_FIRE_ALLOW"),
|
ALLOW("FLAG_FIRE_ALLOW"),
|
||||||
DENY("FLAG_FIRE_DENY");
|
DENY("FLAG_FIRE_DENY");
|
||||||
|
|
||||||
private static FireMode[] values;
|
private static FireMode[] values;
|
||||||
private final String chatValue;
|
private final String chatValue;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FireMode[] getValues() {
|
public FireMode[] getValues() {
|
||||||
if (FireMode.values == null) {
|
if (FireMode.values == null) {
|
||||||
FireMode.values = FireMode.values();
|
FireMode.values = FireMode.values();
|
||||||
}
|
}
|
||||||
return FireMode.values;
|
return FireMode.values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FireMode getValue() {
|
public FireMode getValue() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FireMode getValueOf(final String name) {
|
public FireMode getValueOf(final String name) {
|
||||||
try {
|
try {
|
||||||
return FireMode.valueOf(name.toUpperCase());
|
return FireMode.valueOf(name.toUpperCase());
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
if (name.equalsIgnoreCase("false")) {
|
if (name.equalsIgnoreCase("false")) {
|
||||||
return FireMode.DENY;
|
return FireMode.DENY;
|
||||||
}
|
}
|
||||||
return FireMode.ALLOW;
|
return FireMode.ALLOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,34 +30,34 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum FreezeMode implements Flag.Value<FreezeMode> {
|
public enum FreezeMode implements Flag.Value<FreezeMode> {
|
||||||
|
|
||||||
ACTIVE("FLAG_FREEZE_ACTIVE"),
|
ACTIVE("FLAG_FREEZE_ACTIVE"),
|
||||||
INACTIVE("FLAG_FREEZE_INACTIVE");
|
INACTIVE("FLAG_FREEZE_INACTIVE");
|
||||||
|
|
||||||
private static FreezeMode[] values;
|
private static FreezeMode[] values;
|
||||||
private final String chatValue;
|
private final String chatValue;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FreezeMode[] getValues() {
|
public FreezeMode[] getValues() {
|
||||||
if (FreezeMode.values == null) {
|
if (FreezeMode.values == null) {
|
||||||
FreezeMode.values = FreezeMode.values();
|
FreezeMode.values = FreezeMode.values();
|
||||||
}
|
}
|
||||||
return FreezeMode.values;
|
return FreezeMode.values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FreezeMode getValue() {
|
public FreezeMode getValue() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FreezeMode getValueOf(final String name) {
|
public FreezeMode getValueOf(final String name) {
|
||||||
try {
|
try {
|
||||||
return FreezeMode.valueOf(name.toUpperCase());
|
return FreezeMode.valueOf(name.toUpperCase());
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
if (name.equalsIgnoreCase("false")) {
|
if (name.equalsIgnoreCase("false")) {
|
||||||
return FreezeMode.INACTIVE;
|
return FreezeMode.INACTIVE;
|
||||||
}
|
}
|
||||||
return FreezeMode.INACTIVE;
|
return FreezeMode.INACTIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,32 +29,32 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum TNTMode implements Flag.Value<TNTMode> {
|
public enum TNTMode implements Flag.Value<TNTMode> {
|
||||||
|
|
||||||
ALLOW("FLAG_TNT_ALLOW"),
|
ALLOW("FLAG_TNT_ALLOW"),
|
||||||
DENY("FLAG_TNT_DENY"),
|
DENY("FLAG_TNT_DENY"),
|
||||||
ONLY_TB("FLAG_TNT_ONLY_TB");
|
ONLY_TB("FLAG_TNT_ONLY_TB");
|
||||||
|
|
||||||
private static TNTMode[] values;
|
private static TNTMode[] values;
|
||||||
private final String chatValue;
|
private final String chatValue;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TNTMode[] getValues() {
|
public TNTMode[] getValues() {
|
||||||
if (TNTMode.values == null) {
|
if (TNTMode.values == null) {
|
||||||
TNTMode.values = TNTMode.values();
|
TNTMode.values = TNTMode.values();
|
||||||
}
|
}
|
||||||
return TNTMode.values;
|
return TNTMode.values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TNTMode getValue() {
|
public TNTMode getValue() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TNTMode getValueOf(final String name) {
|
public TNTMode getValueOf(final String name) {
|
||||||
try {
|
try {
|
||||||
return TNTMode.valueOf(name.toUpperCase());
|
return TNTMode.valueOf(name.toUpperCase());
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
return TNTMode.ALLOW;
|
return TNTMode.ALLOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+25
-25
@@ -29,33 +29,33 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum TestblockMode implements Flag.Value<TestblockMode> {
|
public enum TestblockMode implements Flag.Value<TestblockMode> {
|
||||||
|
|
||||||
NO_VALUE("FLAG_TESTBLOCK_NO_VALUE", false),
|
NO_VALUE("FLAG_TESTBLOCK_NO_VALUE", false),
|
||||||
NORTH("FLAG_TESTBLOCK_NORTH", true),
|
NORTH("FLAG_TESTBLOCK_NORTH", true),
|
||||||
SOUTH("FLAG_TESTBLOCK_SOUTH", false);
|
SOUTH("FLAG_TESTBLOCK_SOUTH", false);
|
||||||
|
|
||||||
private static TestblockMode[] values;
|
private static TestblockMode[] values;
|
||||||
private final String chatValue;
|
private final String chatValue;
|
||||||
private final boolean north;
|
private final boolean north;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TestblockMode[] getValues() {
|
public TestblockMode[] getValues() {
|
||||||
if (TestblockMode.values == null) {
|
if (TestblockMode.values == null) {
|
||||||
TestblockMode.values = TestblockMode.values();
|
TestblockMode.values = TestblockMode.values();
|
||||||
}
|
}
|
||||||
return TestblockMode.values;
|
return TestblockMode.values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TestblockMode getValue() {
|
public TestblockMode getValue() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TestblockMode getValueOf(final String name) {
|
public TestblockMode getValueOf(final String name) {
|
||||||
try {
|
try {
|
||||||
return TestblockMode.valueOf(name.toUpperCase());
|
return TestblockMode.valueOf(name.toUpperCase());
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
return NO_VALUE;
|
return NO_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,30 +27,30 @@ import lombok.Getter;
|
|||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class Pair<K, V> {
|
public class Pair<K, V> {
|
||||||
|
|
||||||
private K key;
|
private K key;
|
||||||
|
|
||||||
private V value;
|
private V value;
|
||||||
|
|
||||||
|
|
||||||
public Pair(final K key, final V value) {
|
public Pair(final K key, final V value) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public K setKey(final K key) {
|
public K setKey(final K key) {
|
||||||
final K currentKey = this.key;
|
final K currentKey = this.key;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
return currentKey;
|
return currentKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public V setValue(final V value) {
|
public V setValue(final V value) {
|
||||||
final V currentValue = this.value;
|
final V currentValue = this.value;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
return currentValue;
|
return currentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.key + "=" + this.value;
|
return this.key + "=" + this.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,12 +218,10 @@ public class FlatteningWrapper {
|
|||||||
|
|
||||||
public boolean inWater(org.bukkit.World world, Vector tntPosition) {
|
public boolean inWater(org.bukkit.World world, Vector tntPosition) {
|
||||||
Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
|
Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
|
||||||
if (block.getType() == Material.WATER)
|
if (block.getType() == Material.WATER) return true;
|
||||||
return true;
|
|
||||||
|
|
||||||
BlockData data = block.getBlockData();
|
BlockData data = block.getBlockData();
|
||||||
if (!(data instanceof Waterlogged))
|
if (!(data instanceof Waterlogged)) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
return ((Waterlogged) data).isWaterlogged();
|
return ((Waterlogged) data).isWaterlogged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,10 @@ public class RayTraceUtils {
|
|||||||
REntity nearestHitEntity = null;
|
REntity nearestHitEntity = null;
|
||||||
RRayTraceResult nearestHitResult = null;
|
RRayTraceResult nearestHitResult = null;
|
||||||
double nearestDistanceSq = Double.MAX_VALUE;
|
double nearestDistanceSq = Double.MAX_VALUE;
|
||||||
for (REntity entity: entityList) {
|
for (REntity entity : entityList) {
|
||||||
if (!isOccluded(startPos.toVector(), direction, new Vector(entity.getX(), entity.getY() + 0.5, entity.getZ()))) continue;
|
if (!isOccluded(startPos.toVector(), direction, new Vector(entity.getX(), entity.getY() + 0.5, entity.getZ()))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
double distanceSq = new Vector(entity.getX(), entity.getY() + 0.5, entity.getZ()).distanceSquared(startPos.toVector());
|
double distanceSq = new Vector(entity.getX(), entity.getY() + 0.5, entity.getZ()).distanceSquared(startPos.toVector());
|
||||||
if (distanceSq > 100.0) continue;
|
if (distanceSq > 100.0) continue;
|
||||||
if (distanceSq < nearestDistanceSq) {
|
if (distanceSq < nearestDistanceSq) {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public interface ScoreboardElement {
|
public interface ScoreboardElement {
|
||||||
ScoreboardGroup getGroup();
|
ScoreboardGroup getGroup();
|
||||||
|
|
||||||
int order();
|
int order();
|
||||||
|
|
||||||
String get(Region region, Player p);
|
String get(Region region, Player p);
|
||||||
|
|||||||
@@ -27,22 +27,29 @@ import org.bukkit.boss.BarStyle;
|
|||||||
public interface BauSystemBossbar {
|
public interface BauSystemBossbar {
|
||||||
|
|
||||||
String getTitle();
|
String getTitle();
|
||||||
|
|
||||||
void setTitle(String title);
|
void setTitle(String title);
|
||||||
|
|
||||||
double getProgress();
|
double getProgress();
|
||||||
|
|
||||||
void setProgress(double progress);
|
void setProgress(double progress);
|
||||||
|
|
||||||
BarColor getColor();
|
BarColor getColor();
|
||||||
|
|
||||||
void setColor(BarColor color);
|
void setColor(BarColor color);
|
||||||
|
|
||||||
BarStyle getStyle();
|
BarStyle getStyle();
|
||||||
|
|
||||||
void setStyle(BarStyle style);
|
void setStyle(BarStyle style);
|
||||||
|
|
||||||
boolean hasFlag(BarFlag flag);
|
boolean hasFlag(BarFlag flag);
|
||||||
|
|
||||||
void addFlag(BarFlag flag);
|
void addFlag(BarFlag flag);
|
||||||
|
|
||||||
void removeFlag(BarFlag flag);
|
void removeFlag(BarFlag flag);
|
||||||
|
|
||||||
boolean isVisible();
|
boolean isVisible();
|
||||||
|
|
||||||
void setVisible(boolean visible);
|
void setVisible(boolean visible);
|
||||||
|
|
||||||
Region getRegion();
|
Region getRegion();
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class SimulatorData {
|
|||||||
strings.remove("");
|
strings.remove("");
|
||||||
return strings;
|
return strings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveSimulator(Player player, String name) {
|
public void saveSimulator(Player player, String name) {
|
||||||
YAPIONObject yapionObject = getSimulator(player);
|
YAPIONObject yapionObject = getSimulator(player);
|
||||||
yapionObject.put(name, yapionObject.getArray("").copy());
|
yapionObject.put(name, yapionObject.getArray("").copy());
|
||||||
@@ -81,7 +81,7 @@ public class SimulatorData {
|
|||||||
yapionObject.put("", simulator);
|
yapionObject.put("", simulator);
|
||||||
internalSaveSimulator(player, yapionObject);
|
internalSaveSimulator(player, yapionObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadSimulator(Player player, String name) {
|
public void loadSimulator(Player player, String name) {
|
||||||
YAPIONObject yapionObject = getSimulator(player);
|
YAPIONObject yapionObject = getSimulator(player);
|
||||||
yapionObject.put("", yapionObject.getArray(name).copy());
|
yapionObject.put("", yapionObject.getArray(name).copy());
|
||||||
|
|||||||
+90
-50
@@ -2,67 +2,75 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
<!-- TOC -->
|
<!-- TOC -->
|
||||||
|
|
||||||
* [SteamWar.de - Script System](#steamwarde---script-system)
|
* [SteamWar.de - Script System](#steamwarde---script-system)
|
||||||
* [Einleitung](#einleitung)
|
* [Einleitung](#einleitung)
|
||||||
* [Nutzung mit einer IDE](#nutzung-mit-einer-ide)
|
* [Nutzung mit einer IDE](#nutzung-mit-einer-ide)
|
||||||
* [Basis-Apis](#basis-apis)
|
* [Basis-Apis](#basis-apis)
|
||||||
* [SteamWar.de-Api](#steamwarde-api)
|
* [SteamWar.de-Api](#steamwarde-api)
|
||||||
* [player](#player)
|
* [player](#player)
|
||||||
* [random](#random)
|
* [random](#random)
|
||||||
* [region](#region)
|
* [region](#region)
|
||||||
* [tnt](#tnt)
|
* [tnt](#tnt)
|
||||||
* [trace](#trace)
|
* [trace](#trace)
|
||||||
* [server](#server)
|
* [server](#server)
|
||||||
* [tps](#tps)
|
* [tps](#tps)
|
||||||
* [storage](#storage)
|
* [storage](#storage)
|
||||||
* [inventory](#inventory)
|
* [inventory](#inventory)
|
||||||
* [SteamWar.de-Global-Api](#steamwarde-global-api)
|
* [SteamWar.de-Global-Api](#steamwarde-global-api)
|
||||||
* [Commands](#commands)
|
* [Commands](#commands)
|
||||||
* [Hotkeys](#hotkeys)
|
* [Hotkeys](#hotkeys)
|
||||||
* [Eventtypen](#eventtypen)
|
* [Eventtypen](#eventtypen)
|
||||||
* [BlockEvent](#blockevent)
|
* [BlockEvent](#blockevent)
|
||||||
* [InteractEvent](#interactevent)
|
* [InteractEvent](#interactevent)
|
||||||
* [Position](#position)
|
* [Position](#position)
|
||||||
* [Instabile APIs](#instabile-apis)
|
* [Instabile APIs](#instabile-apis)
|
||||||
* [_worldedit](#worldedit)
|
* [_worldedit](#worldedit)
|
||||||
* [Beispiele](#beispiele)
|
* [Beispiele](#beispiele)
|
||||||
* [Hello, World!](#hello-world)
|
* [Hello, World!](#hello-world)
|
||||||
* [Code](#code)
|
* [Code](#code)
|
||||||
* [Ausgabe](#ausgabe)
|
* [Ausgabe](#ausgabe)
|
||||||
* [BauGUI on DoubleSwap](#baugui-on-doubleswap)
|
* [BauGUI on DoubleSwap](#baugui-on-doubleswap)
|
||||||
* [Code](#code-1)
|
* [Code](#code-1)
|
||||||
* [SL Command](#sl-command)
|
* [SL Command](#sl-command)
|
||||||
* [Code](#code-2)
|
* [Code](#code-2)
|
||||||
* [Paste Hotkey](#paste-hotkey)
|
* [Paste Hotkey](#paste-hotkey)
|
||||||
* [Code](#code-3)
|
* [Code](#code-3)
|
||||||
* [Inventory](#inventory-1)
|
* [Inventory](#inventory-1)
|
||||||
* [Code](#code-4)
|
* [Code](#code-4)
|
||||||
|
|
||||||
<!-- TOC -->
|
<!-- TOC -->
|
||||||
|
|
||||||
|
|
||||||
## Einleitung
|
## Einleitung
|
||||||
Das Script System auf SteamWar.de basiert auf [Lua](https://www.lua.org/docs.html).
|
|
||||||
|
Das Script System auf SteamWar.de basiert auf [Lua](https://www.lua.org/docs.html).
|
||||||
Der Code wird einfach in ein Minecraft Buch geschrieben und kann mit einem Links-Klick ausgeführt werden.
|
Der Code wird einfach in ein Minecraft Buch geschrieben und kann mit einem Links-Klick ausgeführt werden.
|
||||||
|
|
||||||
## Nutzung mit einer IDE
|
## Nutzung mit einer IDE
|
||||||
Im Repository liegen [Lua-Definitionen](sw.def.lua) für [Luanalysis](https://plugins.jetbrains.com/plugin/14698-luanalysis).
|
|
||||||
Diese können in der IDE genutzt werden, um die APIs zu nutzen.
|
Im Repository liegen [Lua-Definitionen](sw.def.lua)
|
||||||
|
für [Luanalysis](https://plugins.jetbrains.com/plugin/14698-luanalysis).
|
||||||
|
Diese können in der IDE genutzt werden, um die APIs zu nutzen.
|
||||||
|
|
||||||
Einfach die `sw.def.lua` in denselben Ordner wie das Script legen und die IDE sollte die APIs erkennen.
|
Einfach die `sw.def.lua` in denselben Ordner wie das Script legen und die IDE sollte die APIs erkennen.
|
||||||
|
|
||||||
# Basis-Apis
|
# Basis-Apis
|
||||||
|
|
||||||
Es werden folgende Standard-Apis zur Verfügung gestellt:
|
Es werden folgende Standard-Apis zur Verfügung gestellt:
|
||||||
|
|
||||||
- [`math`](https://www.lua.org/manual/5.4/manual.html#6.7)
|
- [`math`](https://www.lua.org/manual/5.4/manual.html#6.7)
|
||||||
- [`string`](https://www.lua.org/manual/5.4/manual.html#6.4)
|
- [`string`](https://www.lua.org/manual/5.4/manual.html#6.4)
|
||||||
- [`table`](https://www.lua.org/manual/5.4/manual.html#6.6)
|
- [`table`](https://www.lua.org/manual/5.4/manual.html#6.6)
|
||||||
- [`bit32`](https://www.lua.org/manual/5.2/manual.html#6.7)
|
- [`bit32`](https://www.lua.org/manual/5.2/manual.html#6.7)
|
||||||
|
|
||||||
# SteamWar.de-Api
|
# SteamWar.de-Api
|
||||||
APIs, die mit einem `_` beginnen sind noch nicht stabil und können sich jederzeit ändern.
|
|
||||||
|
APIs, die mit einem `_` beginnen sind noch nicht stabil und können sich jederzeit ändern.
|
||||||
Sie sollten daher nicht verwendet werden, da sie sich noch in der Entwicklung befinden.
|
Sie sollten daher nicht verwendet werden, da sie sich noch in der Entwicklung befinden.
|
||||||
Diese können auch undokumentierte Funktionen enthalten, die nicht in der Dokumentation aufgeführt sind.
|
Diese können auch undokumentierte Funktionen enthalten, die nicht in der Dokumentation aufgeführt sind.
|
||||||
|
|
||||||
In den Scripten gibt es dazu noch folgende globale Variablen:
|
In den Scripten gibt es dazu noch folgende globale Variablen:
|
||||||
|
|
||||||
- [`player`](#player)
|
- [`player`](#player)
|
||||||
- [`random`](#random)
|
- [`random`](#random)
|
||||||
- [`region`](#region)
|
- [`region`](#region)
|
||||||
@@ -84,6 +92,7 @@ Ohne eine Kategorie sind folgende Funktionen verfügbar, die nicht allgemein sin
|
|||||||
| `join` | length(String, String...): String | Füge die Texte mit den ersten Parameter zusammen |
|
| `join` | length(String, String...): String | Füge die Texte mit den ersten Parameter zusammen |
|
||||||
|
|
||||||
### player
|
### player
|
||||||
|
|
||||||
Das `player`-Modul stellt Funktionen zur Verfügung, die den Spieler betreffen.
|
Das `player`-Modul stellt Funktionen zur Verfügung, die den Spieler betreffen.
|
||||||
Es gibt folgende Funktionen:
|
Es gibt folgende Funktionen:
|
||||||
|
|
||||||
@@ -105,6 +114,7 @@ Es gibt folgende Funktionen:
|
|||||||
| `closeInventory` | closeInventory() | Schließe das aktuell geöffnete Inventar des Spielers |
|
| `closeInventory` | closeInventory() | Schließe das aktuell geöffnete Inventar des Spielers |
|
||||||
|
|
||||||
### random
|
### random
|
||||||
|
|
||||||
Das `random`-Modul stellt Funktionen zur Verfügung, die Zufallszahlen betreffen.
|
Das `random`-Modul stellt Funktionen zur Verfügung, die Zufallszahlen betreffen.
|
||||||
Es gibt folgende Funktionen:
|
Es gibt folgende Funktionen:
|
||||||
|
|
||||||
@@ -119,8 +129,9 @@ Es gibt folgende Funktionen:
|
|||||||
| nextBool | nextBool(): Boolean | Gibt true oder false zurück |
|
| nextBool | nextBool(): Boolean | Gibt true oder false zurück |
|
||||||
|
|
||||||
### region
|
### region
|
||||||
|
|
||||||
Das `region`-Modul stellt Funktion zur Verfügung, die die Region des Spielers betreffen.
|
Das `region`-Modul stellt Funktion zur Verfügung, die die Region des Spielers betreffen.
|
||||||
Es gibt folgende Funktionen:
|
Es gibt folgende Funktionen:
|
||||||
|
|
||||||
| Name | Signature | Beschreibung |
|
| Name | Signature | Beschreibung |
|
||||||
|-----------|---------------------|------------------------------------------------------------------------------------------------------------|
|
|-----------|---------------------|------------------------------------------------------------------------------------------------------------|
|
||||||
@@ -141,6 +152,7 @@ Es gibt folgende weitere Module:
|
|||||||
| `trace` | [trace](#trace) |
|
| `trace` | [trace](#trace) |
|
||||||
|
|
||||||
#### tnt
|
#### tnt
|
||||||
|
|
||||||
Das `tnt`-Modul stellt Funktionen zur Verfügung, die den TNT-Modus in der Region des Spielers betreffen.
|
Das `tnt`-Modul stellt Funktionen zur Verfügung, die den TNT-Modus in der Region des Spielers betreffen.
|
||||||
Es gibt folgende Funktionen:
|
Es gibt folgende Funktionen:
|
||||||
|
|
||||||
@@ -151,8 +163,8 @@ Es gibt folgende Funktionen:
|
|||||||
| `onlyTb` | onlyTb(): Boolean | Gibt zurück, ob der TNT-Modus auf Only-Tb ist |
|
| `onlyTb` | onlyTb(): Boolean | Gibt zurück, ob der TNT-Modus auf Only-Tb ist |
|
||||||
| `onlyBuild` | onlyBuild(): Boolean | Gibt zurück, ob der TNT-Modus auf Only-Build ist |
|
| `onlyBuild` | onlyBuild(): Boolean | Gibt zurück, ob der TNT-Modus auf Only-Build ist |
|
||||||
|
|
||||||
|
|
||||||
#### trace
|
#### trace
|
||||||
|
|
||||||
Das `trace`-Modul stellt Funktionen zur Verfügung, die den Status des Tracers der Region betreffen.
|
Das `trace`-Modul stellt Funktionen zur Verfügung, die den Status des Tracers der Region betreffen.
|
||||||
Es gibt folgende Funktionen:
|
Es gibt folgende Funktionen:
|
||||||
|
|
||||||
@@ -164,6 +176,7 @@ Es gibt folgende Funktionen:
|
|||||||
| `time` | time(): String | Gibt die Zeit des Tracers zurück |
|
| `time` | time(): String | Gibt die Zeit des Tracers zurück |
|
||||||
|
|
||||||
## server
|
## server
|
||||||
|
|
||||||
Das `server`-Modul stellt Funktionen zur Verfügung, die den Server betreffen.
|
Das `server`-Modul stellt Funktionen zur Verfügung, die den Server betreffen.
|
||||||
Es gibt folgende Funktionen:
|
Es gibt folgende Funktionen:
|
||||||
|
|
||||||
@@ -181,6 +194,7 @@ Es gibt folgende weitere Module:
|
|||||||
| `tps` | [tps](#tps) |
|
| `tps` | [tps](#tps) |
|
||||||
|
|
||||||
#### tps
|
#### tps
|
||||||
|
|
||||||
Das `tps`-Modul stellt Funktionen zur Verfügung, die die TPS des Servers betreffen.
|
Das `tps`-Modul stellt Funktionen zur Verfügung, die die TPS des Servers betreffen.
|
||||||
Es gibt folgende Funktionen:
|
Es gibt folgende Funktionen:
|
||||||
|
|
||||||
@@ -195,6 +209,7 @@ Es gibt folgende Funktionen:
|
|||||||
| `limit` | limit(): Number | Gibt das TPS-Limit zurück |
|
| `limit` | limit(): Number | Gibt das TPS-Limit zurück |
|
||||||
|
|
||||||
## storage
|
## storage
|
||||||
|
|
||||||
Das `storage`-Modul stellt Funktionen zur Verfügung, mit welchen man Werte speichern kann.
|
Das `storage`-Modul stellt Funktionen zur Verfügung, mit welchen man Werte speichern kann.
|
||||||
|
|
||||||
Es gibt folgende Module:
|
Es gibt folgende Module:
|
||||||
@@ -217,6 +232,7 @@ Alle Module haben folgende Funktionen:
|
|||||||
|
|
||||||
Ein Accessor ist ein Objekt, womit du direkt auf einen Wert zugreifen kannst und es ändern kannst.
|
Ein Accessor ist ein Objekt, womit du direkt auf einen Wert zugreifen kannst und es ändern kannst.
|
||||||
Es geht wie folgt:
|
Es geht wie folgt:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
keyAccessor = storage.player.accessor("key")
|
keyAccessor = storage.player.accessor("key")
|
||||||
|
|
||||||
@@ -225,12 +241,13 @@ print(keyAccessor()) -- Gibt den Wert zurück
|
|||||||
```
|
```
|
||||||
|
|
||||||
## inventory
|
## inventory
|
||||||
|
|
||||||
Das `inventory`-Modul stellt Funktionen zur Verfügung, um ein Inventar zu öffnen.
|
Das `inventory`-Modul stellt Funktionen zur Verfügung, um ein Inventar zu öffnen.
|
||||||
Es gibt folgende Funktionen:
|
Es gibt folgende Funktionen:
|
||||||
|
|
||||||
| Name | Signature | Beschreibung |
|
| Name | Signature | Beschreibung |
|
||||||
|----------|-----------------------------------|-------------------------------------------------------------------|
|
|----------|-----------------------------------|--------------------------------------------------------------|
|
||||||
| `create` | create(String, Number): Inventory | Erstellt ein Inventar mit dem Title und der Anzahl an Zeilen |
|
| `create` | create(String, Number): Inventory | Erstellt ein Inventar mit dem Title und der Anzahl an Zeilen |
|
||||||
|
|
||||||
Das `Inventory`-Objekt hat folgende Funktionen:
|
Das `Inventory`-Objekt hat folgende Funktionen:
|
||||||
|
|
||||||
@@ -256,6 +273,7 @@ Wenn eine Barrier statt des richtigen Items angezeigt wird, dann ist das angegeb
|
|||||||
```
|
```
|
||||||
|
|
||||||
# SteamWar.de-Global-Api
|
# SteamWar.de-Global-Api
|
||||||
|
|
||||||
Mit `/script` kann man Script-Bücher global abspeichern. Diese haben dann zugrif auf die `global`-Api.
|
Mit `/script` kann man Script-Bücher global abspeichern. Diese haben dann zugrif auf die `global`-Api.
|
||||||
Die `global`-Api stellt Funktionen zur Verfügung um auf Events, Commands und Hotkeys mit einem Script zu reagieren.
|
Die `global`-Api stellt Funktionen zur Verfügung um auf Events, Commands und Hotkeys mit einem Script zu reagieren.
|
||||||
|
|
||||||
@@ -274,20 +292,28 @@ Es gibt folgende Variablen:
|
|||||||
| `events` | Siehe: [Event Type](#eventtypen) |
|
| `events` | Siehe: [Event Type](#eventtypen) |
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
Der Command Handler kriegt eine Liste aller angegeben argumenten. Die Argumente sind vom Typ `String`. Mit dem Wert gespeichert unter `args.alias` oder `args["alias"]` erhältst du, welcher command eingegeben wurde. Wenn ein handler für mehrere Befehle registriert wurde kannst du es hiermit erkennen.
|
|
||||||
Du kannst `args.hasShortFlag(String)` um herauszufinden ob eine Flag angegeben wurde wie zum Beispiel `-f`. Mit `args.removeShortFlag(String)` kannst du die Flag entfernen und erhältst ob sie angegeben wurde.
|
Der Command Handler kriegt eine Liste aller angegeben argumenten. Die Argumente sind vom Typ `String`. Mit dem Wert
|
||||||
|
gespeichert unter `args.alias` oder `args["alias"]` erhältst du, welcher command eingegeben wurde. Wenn ein handler für
|
||||||
|
mehrere Befehle registriert wurde kannst du es hiermit erkennen.
|
||||||
|
Du kannst `args.hasShortFlag(String)` um herauszufinden ob eine Flag angegeben wurde wie zum Beispiel `-f`. Mit
|
||||||
|
`args.removeShortFlag(String)` kannst du die Flag entfernen und erhältst ob sie angegeben wurde.
|
||||||
|
|
||||||
## Hotkeys
|
## Hotkeys
|
||||||
|
|
||||||
Hotkeys werden im folgenden Format angegeben: `MODIFIER+KEY`. Bei den Hotkey erstellung ist die Großschreibung egal. Es gibt folgende Modifier:
|
Hotkeys werden im folgenden Format angegeben: `MODIFIER+KEY`. Bei den Hotkey erstellung ist die Großschreibung egal. Es
|
||||||
|
gibt folgende Modifier:
|
||||||
|
|
||||||
- `ctrl`
|
- `ctrl`
|
||||||
- `shift`
|
- `shift`
|
||||||
- `alt`
|
- `alt`
|
||||||
- `meta`
|
- `meta`
|
||||||
|
|
||||||
Es können auch mehrere Modifier angegeben werden, z.B. `ctrl+shift+alt+c`. Die Reihenfolge der Modifier und des Keys ist egal.
|
Es können auch mehrere Modifier angegeben werden, z.B. `ctrl+shift+alt+c`. Die Reihenfolge der Modifier und des Keys ist
|
||||||
|
egal.
|
||||||
|
|
||||||
## Eventtypen
|
## Eventtypen
|
||||||
|
|
||||||
Einige Events sind auch abbrechbar, dazu muss die Funktion `setCancelled()` aufgerufen werden.
|
Einige Events sind auch abbrechbar, dazu muss die Funktion `setCancelled()` aufgerufen werden.
|
||||||
|
|
||||||
| Name | Wenn | Parameter | Abbrechbar |
|
| Name | Wenn | Parameter | Abbrechbar |
|
||||||
@@ -306,6 +332,7 @@ Einige Events sind auch abbrechbar, dazu muss die Funktion `setCancelled()` aufg
|
|||||||
| `EntityDeath` | Wenn ein Entity stirbt | (type: Entity Type) | false |
|
| `EntityDeath` | Wenn ein Entity stirbt | (type: Entity Type) | false |
|
||||||
|
|
||||||
### BlockEvent
|
### BlockEvent
|
||||||
|
|
||||||
Das übergebene Objekt an den Handler hat folgende Variablen:
|
Das übergebene Objekt an den Handler hat folgende Variablen:
|
||||||
|
|
||||||
| Name | Beschreibung |
|
| Name | Beschreibung |
|
||||||
@@ -316,6 +343,7 @@ Das übergebene Objekt an den Handler hat folgende Variablen:
|
|||||||
| `type` | Das Material des Blocks |
|
| `type` | Das Material des Blocks |
|
||||||
|
|
||||||
### InteractEvent
|
### InteractEvent
|
||||||
|
|
||||||
Das übergebene Objekt an den Handler hat folgende Variablen:
|
Das übergebene Objekt an den Handler hat folgende Variablen:
|
||||||
|
|
||||||
| Name | Beschreibung |
|
| Name | Beschreibung |
|
||||||
@@ -334,8 +362,8 @@ Wenn `hasBlock` wahr ist, gibt es folgende Variablen:
|
|||||||
| `blockZ` | Die Z-Koordinate des Blocks |
|
| `blockZ` | Die Z-Koordinate des Blocks |
|
||||||
| `blockFace` | Die Seite des Blocks die geklickt wurde |
|
| `blockFace` | Die Seite des Blocks die geklickt wurde |
|
||||||
|
|
||||||
|
|
||||||
### Position
|
### Position
|
||||||
|
|
||||||
Die Position ist ein Objekt mit folgenden Variablen:
|
Die Position ist ein Objekt mit folgenden Variablen:
|
||||||
|
|
||||||
| Name | Beschreibung |
|
| Name | Beschreibung |
|
||||||
@@ -345,6 +373,7 @@ Die Position ist ein Objekt mit folgenden Variablen:
|
|||||||
| `z` | Die Z-Koordinate |
|
| `z` | Die Z-Koordinate |
|
||||||
|
|
||||||
# Instabile APIs
|
# Instabile APIs
|
||||||
|
|
||||||
Hier sind einige APIs aufgelistet, die nicht stabil sind und sich jederzeit ändern können.
|
Hier sind einige APIs aufgelistet, die nicht stabil sind und sich jederzeit ändern können.
|
||||||
|
|
||||||
## _worldedit
|
## _worldedit
|
||||||
@@ -353,67 +382,78 @@ Hier sind einige APIs aufgelistet, die nicht stabil sind und sich jederzeit änd
|
|||||||
|-------------|-----------------------------------------------------------|-----------------------------------|
|
|-------------|-----------------------------------------------------------|-----------------------------------|
|
||||||
| `selection` | selection(Liste\<Pos>), selection(): {min: Pos, max: Pos} | Die aktuelle auswahl des Spielers |
|
| `selection` | selection(Liste\<Pos>), selection(): {min: Pos, max: Pos} | Die aktuelle auswahl des Spielers |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Beispiele
|
# Beispiele
|
||||||
|
|
||||||
## Hello, World!
|
## Hello, World!
|
||||||
|
|
||||||
Ein einfaches Hello, World!-Script.
|
Ein einfaches Hello, World!-Script.
|
||||||
|
|
||||||
#### Code
|
#### Code
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
print("Hello, World!")
|
print("Hello, World!")
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Ausgabe
|
#### Ausgabe
|
||||||
|
|
||||||
```
|
```
|
||||||
Hello, World!
|
Hello, World!
|
||||||
```
|
```
|
||||||
|
|
||||||
## BauGUI on DoubleSwap
|
## BauGUI on DoubleSwap
|
||||||
|
|
||||||
Das Standardskript für das Öffnen des BauGUIs
|
Das Standardskript für das Öffnen des BauGUIs
|
||||||
|
|
||||||
#### Code
|
#### Code
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
function handler(event)
|
function handler(event)
|
||||||
exec("gui")
|
exec("gui")
|
||||||
end
|
end
|
||||||
|
|
||||||
event(events.DoubleSwap, handler)
|
event(events.DoubleSwap, handler)
|
||||||
```
|
```
|
||||||
|
|
||||||
## SL Command
|
## SL Command
|
||||||
|
|
||||||
Ein einfacher Command Redefiner.
|
Ein einfacher Command Redefiner.
|
||||||
|
|
||||||
#### Code
|
#### Code
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
function handler(args)
|
function handler(args)
|
||||||
exec("stoplag")
|
exec("stoplag")
|
||||||
end
|
end
|
||||||
|
|
||||||
command("sl", handler)
|
command("sl", handler)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Paste Hotkey
|
## Paste Hotkey
|
||||||
|
|
||||||
Ein Hotkey zum Pasten des Clipboard-Inhalts.
|
Ein Hotkey zum Pasten des Clipboard-Inhalts.
|
||||||
|
|
||||||
#### Code
|
#### Code
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
function handler(pressed)
|
function handler(pressed)
|
||||||
if pressed then
|
if pressed then
|
||||||
exec("/paste -o")
|
exec("/paste -o")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
hotkey("ctrl+v", handler)
|
hotkey("ctrl+v", handler)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Inventory
|
## Inventory
|
||||||
|
|
||||||
Ein Beispiel für ein Inventar.
|
Ein Beispiel für ein Inventar.
|
||||||
|
|
||||||
#### Code
|
#### Code
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
inv = inventory.create("Test Inv", 3)
|
inv = inventory.create("Test Inv", 3)
|
||||||
inv.item(13, "STONE", "Ich bin ein Stein", function(e) player.chat(e) end, {"Die Lore", "Die Zweite Zeile"}, true)
|
inv.item(13, "STONE", "Ich bin ein Stein", function(e)
|
||||||
|
player.chat(e)
|
||||||
|
end, { "Die Lore", "Die Zweite Zeile" }, true)
|
||||||
inv.open()
|
inv.open()
|
||||||
```
|
```
|
||||||
@@ -43,7 +43,7 @@ function hotkeys_cycle_trace_view(pressed)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
trace_cycle = (trace_cycle + 1) % 3
|
trace_cycle = (trace_cycle + 1) % 3
|
||||||
trace_commands = {"trace hide", "trace show", "trace show -e -c"}
|
trace_commands = { "trace hide", "trace show", "trace show -e -c" }
|
||||||
exec(trace_commands[trace_cycle + 1])
|
exec(trace_commands[trace_cycle + 1])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+213
-81
@@ -26,7 +26,9 @@ inventory = {}
|
|||||||
---@param title string
|
---@param title string
|
||||||
---@param size number
|
---@param size number
|
||||||
---@return Inventory
|
---@return Inventory
|
||||||
function inventory.create(title, size) return nil end
|
function inventory.create(title, size)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@alias InventoryClick 'LEFT' | 'SHIFT_LEFT' | 'RIGHT' | 'SHIFT_RIGHT' | 'MIDDLE' | 'NUMBER_KEY'
|
---@alias InventoryClick 'LEFT' | 'SHIFT_LEFT' | 'RIGHT' | 'SHIFT_RIGHT' | 'MIDDLE' | 'NUMBER_KEY'
|
||||||
|
|
||||||
@@ -44,66 +46,88 @@ local Inventory = {}
|
|||||||
---@param enchanted boolean
|
---@param enchanted boolean
|
||||||
---@param amount number
|
---@param amount number
|
||||||
---@return void
|
---@return void
|
||||||
function Inventory.item(slot, material, name, handler, lore, enchanted, amount) end
|
function Inventory.item(slot, material, name, handler, lore, enchanted, amount)
|
||||||
|
end
|
||||||
|
|
||||||
---@param handler fun(): void
|
---@param handler fun(): void
|
||||||
---@return void
|
---@return void
|
||||||
function Inventory.setCloseHandler(handler) end
|
function Inventory.setCloseHandler(handler)
|
||||||
|
end
|
||||||
|
|
||||||
---@return void
|
---@return void
|
||||||
function Inventory.open() end
|
function Inventory.open()
|
||||||
|
end
|
||||||
|
|
||||||
player = {}
|
player = {}
|
||||||
|
|
||||||
---@return string
|
---@return string
|
||||||
---Get the name of the player.
|
---Get the name of the player.
|
||||||
function player.name() return "" end
|
function player.name()
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
---@return void
|
---@return void
|
||||||
function player.chat(...) end
|
function player.chat(...)
|
||||||
|
end
|
||||||
|
|
||||||
---@return void
|
---@return void
|
||||||
---Send a message to the actionbar of the player.
|
---Send a message to the actionbar of the player.
|
||||||
function player.actionbar(...) end
|
function player.actionbar(...)
|
||||||
|
end
|
||||||
|
|
||||||
---@overload fun(): number
|
---@overload fun(): number
|
||||||
---@param newX number
|
---@param newX number
|
||||||
function player.x(newX) end
|
function player.x(newX)
|
||||||
|
end
|
||||||
|
|
||||||
---@overload fun(): number
|
---@overload fun(): number
|
||||||
---@param newY number
|
---@param newY number
|
||||||
function player.y(newY) end
|
function player.y(newY)
|
||||||
|
end
|
||||||
|
|
||||||
---@overload fun(): number
|
---@overload fun(): number
|
||||||
---@param newZ number
|
---@param newZ number
|
||||||
function player.z(newZ) end
|
function player.z(newZ)
|
||||||
|
end
|
||||||
|
|
||||||
---@overload fun(): number
|
---@overload fun(): number
|
||||||
---@param newYaw number
|
---@param newYaw number
|
||||||
function player.yaw(newYaw) end
|
function player.yaw(newYaw)
|
||||||
|
end
|
||||||
|
|
||||||
---@overload fun(): number
|
---@overload fun(): number
|
||||||
---@param newPitch number
|
---@param newPitch number
|
||||||
function player.pitch(newPitch) end
|
function player.pitch(newPitch)
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function player.sneaking() return nil end
|
function player.sneaking()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function player.sprinting() return nil end
|
function player.sprinting()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@overload fun(): number
|
---@overload fun(): number
|
||||||
---@param newSlot number
|
---@param newSlot number
|
||||||
function player.slot(newSlot) end
|
function player.slot(newSlot)
|
||||||
|
end
|
||||||
|
|
||||||
---@return string
|
---@return string
|
||||||
function player.item() return nil end
|
function player.item()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return string
|
---@return string
|
||||||
function player.offHandItem() return nil end
|
function player.offHandItem()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return void
|
---@return void
|
||||||
function player.closeInventory() end
|
function player.closeInventory()
|
||||||
|
end
|
||||||
|
|
||||||
---@field nextBool fun(): boolean
|
---@field nextBool fun(): boolean
|
||||||
random = {}
|
random = {}
|
||||||
@@ -113,17 +137,23 @@ random = {}
|
|||||||
---@param origin number
|
---@param origin number
|
||||||
---@param bound number
|
---@param bound number
|
||||||
---@return number
|
---@return number
|
||||||
function random.nextInt(origin, bound) return nil end
|
function random.nextInt(origin, bound)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@overload fun(): number
|
---@overload fun(): number
|
||||||
---@overload fun(bound: number): number
|
---@overload fun(bound: number): number
|
||||||
---@param origin number
|
---@param origin number
|
||||||
---@param bound number
|
---@param bound number
|
||||||
---@return number
|
---@return number
|
||||||
function random.nextDouble(origin, bound) return nil end
|
function random.nextDouble(origin, bound)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function random.nextBool() return nil end
|
function random.nextBool()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@alias RegionType 'wg' | 'mwg' | 'as' | 'ws' | 'ws_inner' | 'ws_rumpf' | 'ws_rahmen' | 'spawn'
|
---@alias RegionType 'wg' | 'mwg' | 'as' | 'ws' | 'ws_inner' | 'ws_rumpf' | 'ws_rahmen' | 'spawn'
|
||||||
|
|
||||||
@@ -136,52 +166,84 @@ local iregion = {}
|
|||||||
region = {}
|
region = {}
|
||||||
|
|
||||||
---@return string
|
---@return string
|
||||||
function iregion.name() return nil end
|
function iregion.name()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return RegionType
|
---@return RegionType
|
||||||
function iregion.type() return nil end
|
function iregion.type()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function iregion.fire() return nil end
|
function iregion.fire()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function iregion.freeze() return nil end
|
function iregion.freeze()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function iregion.protect() return nil end
|
function iregion.protect()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return string
|
---@return string
|
||||||
function iregion.loader() return nil end
|
function iregion.loader()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return Position
|
---@return Position
|
||||||
function iregion.copyPoint() return nil end
|
function iregion.copyPoint()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return Position
|
---@return Position
|
||||||
function iregion.minPointBuild() return nil end
|
function iregion.minPointBuild()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return Position
|
---@return Position
|
||||||
function iregion.maxPointBuild() return nil end
|
function iregion.maxPointBuild()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return Position
|
---@return Position
|
||||||
function iregion.minPointBuildExtension() return nil end
|
function iregion.minPointBuildExtension()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return Position
|
---@return Position
|
||||||
function iregion.maxPointBuildExtension() return nil end
|
function iregion.maxPointBuildExtension()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return Position
|
---@return Position
|
||||||
function iregion.testblockPoint() return nil end
|
function iregion.testblockPoint()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return Position
|
---@return Position
|
||||||
function iregion.minPointTestblock() return nil end
|
function iregion.minPointTestblock()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return Position
|
---@return Position
|
||||||
function iregion.maxPointTestblock() return nil end
|
function iregion.maxPointTestblock()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return Position
|
---@return Position
|
||||||
function iregion.minPointTestblockExtension() return nil end
|
function iregion.minPointTestblockExtension()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return Position
|
---@return Position
|
||||||
function iregion.maxPointTestblockExtension() return nil end
|
function iregion.maxPointTestblockExtension()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@alias TNTMode 'ALLOW' | 'DENY' | 'ONLY_TB'
|
---@alias TNTMode 'ALLOW' | 'DENY' | 'ONLY_TB'
|
||||||
|
|
||||||
@@ -189,23 +251,35 @@ function iregion.maxPointTestblockExtension() return nil end
|
|||||||
local tnt = {}
|
local tnt = {}
|
||||||
|
|
||||||
---@return TNTMode
|
---@return TNTMode
|
||||||
function tnt.mode() return nil end
|
function tnt.mode()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function tnt.enabled() return nil end
|
function tnt.enabled()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function tnt.onlyTb() return nil end
|
function tnt.onlyTb()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function tnt.onlyBuild() return nil end
|
function tnt.onlyBuild()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@param name string
|
---@param name string
|
||||||
---@return iregion
|
---@return iregion
|
||||||
function region.get(name) return nil end
|
function region.get(name)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return iregion[]
|
---@return iregion[]
|
||||||
function region.list() return nil end
|
function region.list()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@class tracerLib
|
---@class tracerLib
|
||||||
tracer = {}
|
tracer = {}
|
||||||
@@ -224,7 +298,9 @@ tracer = {}
|
|||||||
---@field getId fun(): string
|
---@field getId fun(): string
|
||||||
---@field getRecords fun(): {[number]: {[number]: TraceRecord}}
|
---@field getRecords fun(): {[number]: {[number]: TraceRecord}}
|
||||||
|
|
||||||
function tracer.getTraces() return nil end
|
function tracer.getTraces()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@class Position
|
---@class Position
|
||||||
---@field x number
|
---@field x number
|
||||||
@@ -236,43 +312,65 @@ function tracer.getTraces() return nil end
|
|||||||
server = {}
|
server = {}
|
||||||
|
|
||||||
---@return string
|
---@return string
|
||||||
function server.time() return nil end
|
function server.time()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return number
|
---@return number
|
||||||
function server.ticks() return nil end
|
function server.ticks()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@param position Position
|
---@param position Position
|
||||||
---@return string
|
---@return string
|
||||||
function getBlockAt(position) return nil end
|
function getBlockAt(position)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@param position Position
|
---@param position Position
|
||||||
---@param material string
|
---@param material string
|
||||||
---@return void
|
---@return void
|
||||||
function setBlockAt(position, material) return nil end
|
function setBlockAt(position, material)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@class tps
|
---@class tps
|
||||||
local tps = {}
|
local tps = {}
|
||||||
|
|
||||||
---@return number
|
---@return number
|
||||||
function tps.oneSecond() return nil end
|
function tps.oneSecond()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return number
|
---@return number
|
||||||
function tps.tenSecond() return nil end
|
function tps.tenSecond()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return number
|
---@return number
|
||||||
function tps.oneMinute() return nil end
|
function tps.oneMinute()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return number
|
---@return number
|
||||||
function tps.fiveMinute() return nil end
|
function tps.fiveMinute()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return number
|
---@return number
|
||||||
function tps.tenMinute() return nil end
|
function tps.tenMinute()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return number
|
---@return number
|
||||||
function tps.current() return nil end
|
function tps.current()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return number
|
---@return number
|
||||||
function tps.limit() return nil end
|
function tps.limit()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@class storage
|
---@class storage
|
||||||
---@field global storageLib
|
---@field global storageLib
|
||||||
@@ -286,24 +384,32 @@ local storageLib = {}
|
|||||||
|
|
||||||
---@param key string
|
---@param key string
|
||||||
---@return any
|
---@return any
|
||||||
function storageLib.get(key) return nil end
|
function storageLib.get(key)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@param key string
|
---@param key string
|
||||||
---@param value any
|
---@param value any
|
||||||
---@return void
|
---@return void
|
||||||
function storageLib.set(key, value) end
|
function storageLib.set(key, value)
|
||||||
|
end
|
||||||
|
|
||||||
---@param key string
|
---@param key string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function storageLib.has(key) return nil end
|
function storageLib.has(key)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@param key string
|
---@param key string
|
||||||
---@return void
|
---@return void
|
||||||
function storageLib.remove(key) end
|
function storageLib.remove(key)
|
||||||
|
end
|
||||||
|
|
||||||
---@param key string
|
---@param key string
|
||||||
---@return Accessor
|
---@return Accessor
|
||||||
function storageLib.accessor(key) return nil end
|
function storageLib.accessor(key)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@class Accessor
|
---@class Accessor
|
||||||
---@overload fun(): any
|
---@overload fun(): any
|
||||||
@@ -318,35 +424,46 @@ _worldedit = {}
|
|||||||
|
|
||||||
---@overload fun(pos: Position[]): void
|
---@overload fun(pos: Position[]): void
|
||||||
---@return Selection
|
---@return Selection
|
||||||
function _worldedit.selection() return nil end
|
function _worldedit.selection()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@param callback fun(value: string): void
|
---@param callback fun(value: string): void
|
||||||
---@return void
|
---@return void
|
||||||
function input(msg, callback) end
|
function input(msg, callback)
|
||||||
|
end
|
||||||
|
|
||||||
---@param ticks number
|
---@param ticks number
|
||||||
---@param callback fun(): void
|
---@param callback fun(): void
|
||||||
---@return void
|
---@return void
|
||||||
function delayed(ticks, callback) end
|
function delayed(ticks, callback)
|
||||||
|
end
|
||||||
|
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
---@return Position
|
---@return Position
|
||||||
function pos(x, y, z) return nil end
|
function pos(x, y, z)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return void
|
---@return void
|
||||||
function exec(...) end
|
function exec(...)
|
||||||
|
end
|
||||||
|
|
||||||
---@param obj any
|
---@param obj any
|
||||||
---@return number
|
---@return number
|
||||||
function length(obj) return 0 end
|
function length(obj)
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
---@param separator string
|
---@param separator string
|
||||||
---@param table any[]
|
---@param table any[]
|
||||||
---@return string
|
---@return string
|
||||||
function join(separator, table) return "" end
|
function join(separator, table)
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
---@class EventType
|
---@class EventType
|
||||||
---@class events
|
---@class events
|
||||||
@@ -364,21 +481,23 @@ function join(separator, table) return "" end
|
|||||||
---@field EntityDeath EventType
|
---@field EntityDeath EventType
|
||||||
events = {}
|
events = {}
|
||||||
|
|
||||||
|
|
||||||
---@param id EventType
|
---@param id EventType
|
||||||
---@param handler fun(params: any): void
|
---@param handler fun(params: any): void
|
||||||
---@return void
|
---@return void
|
||||||
function event(id, handler) end
|
function event(id, handler)
|
||||||
|
end
|
||||||
|
|
||||||
---@param command string
|
---@param command string
|
||||||
---@param handler fun(params: string[]): void
|
---@param handler fun(params: string[]): void
|
||||||
---@return void
|
---@return void
|
||||||
function command(command, handler) end
|
function command(command, handler)
|
||||||
|
end
|
||||||
|
|
||||||
---@param trigger string
|
---@param trigger string
|
||||||
---@param handler fun(pressed: boolean): void
|
---@param handler fun(pressed: boolean): void
|
||||||
---@return void
|
---@return void
|
||||||
function hotkey(trigger, handler) end
|
function hotkey(trigger, handler)
|
||||||
|
end
|
||||||
|
|
||||||
---@class bossbar
|
---@class bossbar
|
||||||
bossbar = {}
|
bossbar = {}
|
||||||
@@ -394,39 +513,52 @@ local BossBar = {}
|
|||||||
---@param color BossBarColor
|
---@param color BossBarColor
|
||||||
---@param style BossBarStyle
|
---@param style BossBarStyle
|
||||||
---@return BossBar
|
---@return BossBar
|
||||||
function bossbar.create(title, color, style) return nil end
|
function bossbar.create(title, color, style)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return string
|
---@return string
|
||||||
---@overload fun(title: string): void
|
---@overload fun(title: string): void
|
||||||
function BossBar.title() end
|
function BossBar.title()
|
||||||
|
end
|
||||||
|
|
||||||
---@return BossBarColor
|
---@return BossBarColor
|
||||||
---@overload fun(color: BossBarColor): void
|
---@overload fun(color: BossBarColor): void
|
||||||
function BossBar.color() end
|
function BossBar.color()
|
||||||
|
end
|
||||||
|
|
||||||
---@return BossBarStyle
|
---@return BossBarStyle
|
||||||
---@overload fun(style: BossBarStyle): void
|
---@overload fun(style: BossBarStyle): void
|
||||||
function BossBar.style() end
|
function BossBar.style()
|
||||||
|
end
|
||||||
|
|
||||||
---@return number
|
---@return number
|
||||||
---@overload fun(progress: number): void
|
---@overload fun(progress: number): void
|
||||||
function BossBar.progress() end
|
function BossBar.progress()
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
---@overload fun(visible: boolean): void
|
---@overload fun(visible: boolean): void
|
||||||
function BossBar.visible() end
|
function BossBar.visible()
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
---@param flag BossBarFlag
|
---@param flag BossBarFlag
|
||||||
function BossBar.hasFlag(flag) return nil end
|
function BossBar.hasFlag(flag)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return void
|
---@return void
|
||||||
---@param flag BossBarFlag
|
---@param flag BossBarFlag
|
||||||
function BossBar.addFlag(flag) end
|
function BossBar.addFlag(flag)
|
||||||
|
end
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
---@param flag BossBarFlag
|
---@param flag BossBarFlag
|
||||||
function BossBar.removeFlag(flag) return nil end
|
function BossBar.removeFlag(flag)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@return void
|
---@return void
|
||||||
function BossBar.destroy() end
|
function BossBar.destroy()
|
||||||
|
end
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user