SteamWar/BauSystem2.0
Archiviert
12
0

Add Countingwand... multilingual

Dieser Commit ist enthalten in:
yoyosource 2021-05-13 17:25:58 +02:00
Ursprung 74e937d7b5
Commit e127e15304
5 geänderte Dateien mit 33 neuen und 52 gelöschten Zeilen

Datei anzeigen

@ -106,7 +106,7 @@ BAU_NO-PLAYER = §cDer Spieler ist kein Mitglied deiner Welt!
BAU_NO-WORLD = §cDies ist nicht deine Welt!
BAU_INFO_ITEM_NAME = §eBau management
# This is used in BauInfoBauGuiItem.java
## This is used in BauInfoBauGuiItem.java
BAU-INFO_ITEM_LORE-TNT = §7TNT §8: §e{0}
BAU-INFO_ITEM_LORE-FREEZE = §7Freeze §8: §e{0}
BAU-INFO_ITEM_LORE-FIRE = §7Feuer §8: §e{0}
@ -118,6 +118,14 @@ BAU-INFO_COMMAND_OWNER = §7Besitzer: §e{0}
BAU-INFO_COMMAND_MEMBER = §7Mitglieder: §e{0}
BAU-INFO_COMMAND_FLAG = §e{0} §8: §7{1}
# Countingwand
COUNTINGWAND_ITEM_NAME = §eZollstock
COUNTINGWAND_ITEM_LORE1 = §eLinksklick §8- §7Setzt die 1. Position
COUNTINGWAND_ITEM_LORE2 = §eRechtsklick §8- §7Setzt die 2. Position
COUNTINGWAND_MESSAGE_R-CLICK = §7Erste Position bei: §8[§7{0}§8, §7{1}§8, §7{2}§8] ({3})
COUNTINGWAND_MESSAGE_L-CLICK = §7Zweite Position bei: §8[§7{0}§8, §7{1}§8, §7{2}§8] ({3})
COUNTINGWAND_MESSAGE_DIMENSION = §e{0}§8, §e{1}§8, §e{2}
# GUI
GUI_EDITOR_ITEM-NAME=§eGui Editor
GUI_EXPORT_CODE=§eDein Gui-Code:

Datei anzeigen

@ -19,19 +19,15 @@
package de.steamwar.bausystem.features.autostart;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
@Linked(LinkageType.BAU_GUI_ITEM)
public class AutoStartGuiItem extends BauGuiItem {
@ -41,7 +37,9 @@ public class AutoStartGuiItem extends BauGuiItem {
@Override
public ItemStack getItem(Player player) {
return new SWItem(Material.FIREWORK_STAR, BauSystem.MESSAGE.parse("AUTOSTART_ITEM_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("AUTOSTART_ITEM_LORE", player)), false, null).getItemStack();
ItemStack itemStack = AutostartListener.getWandItem(player);
itemStack.setType(Material.FIREWORK_STAR);
return itemStack;
}
@Override

Datei anzeigen

@ -25,6 +25,8 @@ import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.inventory.SWItem;
import java.util.*;
import de.steamwar.message.Message;
import lombok.experimental.UtilityClass;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -34,17 +36,14 @@ import org.bukkit.inventory.ItemStack;
@UtilityClass
public class Countingwand {
public final ItemStack WAND_ITEM = new SWItem(Material.STICK,
ColorConfig.HIGHLIGHT + "Zollstock",
Arrays.asList(ColorConfig.HIGHLIGHT + "Linksklick" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Setzt die 1. Position",
ColorConfig.HIGHLIGHT + "Rechtsklick" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Setzt die 2. Position"),
false, clickType -> {
}).getItemStack();
public static ItemStack getWandItem(Player player) {
return 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();
}
private final Map<String, Pair<Point, Point>> selections = new HashMap<>();
public boolean isCountingwand(final ItemStack item) {
return WAND_ITEM.isSimilar(item);
public boolean isCountingwand(Player player, ItemStack itemStack) {
return getWandItem(player).isSimilar(itemStack);
}
public void checkSelection(final Point point, final boolean pos1, final Player p) {
@ -67,38 +66,24 @@ public class Countingwand {
}
if (newPos) {
p.sendMessage(BauSystem.PREFIX
+ (pos1 ? "Erste Position bei: " : "Zweite Position bei: ")
+ ColorConfig.OTHER
+ "["
+ ColorConfig.BASE
+ point.getX()
+ ColorConfig.OTHER
+ ", "
+ ColorConfig.BASE
+ point.getY()
+ ColorConfig.OTHER
+ ", "
+ ColorConfig.BASE
+ point.getZ()
+ ColorConfig.OTHER
+ "] ("
+ Countingwand.getDimensions(selection.getKey(), selection.getValue())
+ ColorConfig.OTHER
+ ")");
String dimension = getDimensions(p, selection.getKey(), selection.getValue());
if (pos1) {
BauSystem.MESSAGE.send("COUNTINGWAND_MESSAGE_R-CLICK", p, point.getX(), point.getY(), point.getZ(), dimension);
} else {
BauSystem.MESSAGE.send("COUNTINGWAND_MESSAGE_L-CLICK", p, point.getX(), point.getY(), point.getZ(), dimension);
}
}
}
public void removePlayer(Player p) {
selections.remove(p);
selections.remove(p.getUniqueId().toString());
}
public String getDimensions(final Point point1, final Point point2) {
public String getDimensions(Player player, final Point point1, final Point point2) {
if (point1 == null || point2 == null) {
return ColorConfig.HIGHLIGHT + "0" + ColorConfig.OTHER + "," + ColorConfig.HIGHLIGHT + "0" + ColorConfig.OTHER + "," + ColorConfig.HIGHLIGHT + "0";
return BauSystem.MESSAGE.parse("COUNTINGWAND_MESSAGE_DIMENSION", player, 0, 0, 0);
}
return ColorConfig.HIGHLIGHT + "" + (Math.abs(point1.getX() - point2.getX()) + 1) + ColorConfig.OTHER + ", " + ColorConfig.HIGHLIGHT + "" + (Math.abs(point1.getY() - point2.getY()) + 1) + ColorConfig.OTHER + ", " +ColorConfig.HIGHLIGHT + "" + (Math.abs(point1.getZ() - point2.getZ()) + 1) + ColorConfig.OTHER;
return BauSystem.MESSAGE.parse("COUNTINGWAND_MESSAGE_DIMENSION", player, Math.abs(point1.getX() - point2.getX()) + 1, Math.abs(point1.getY() - point2.getY()) + 1, Math.abs(point1.getZ() - point2.getZ()) + 1);
}
public int getAmount(final Point point1, final Point point2) {

Datei anzeigen

@ -20,18 +20,13 @@
package de.steamwar.bausystem.features.countingwand;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
@Linked(LinkageType.BAU_GUI_ITEM)
public class CountingwandGuiItem extends BauGuiItem {
@ -42,12 +37,7 @@ public class CountingwandGuiItem extends BauGuiItem {
@Override
public ItemStack getItem(Player player) {
return new SWItem(Material.STICK,
ColorConfig.HIGHLIGHT + "Zollstock",
Arrays.asList(ColorConfig.HIGHLIGHT + "Linksklick" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Setzt die 1. Position",
ColorConfig.HIGHLIGHT + "Rechtsklick" + ColorConfig.OTHER + " - " + ColorConfig.BASE + "Setzt die 2. Position"),
false, clickType -> {
}).getItemStack();
return Countingwand.getWandItem(player);
}
@Override

Datei anzeigen

@ -36,7 +36,7 @@ public class CountingwandListener implements Listener {
@EventHandler
public void onBlockBreak(final BlockBreakEvent event) {
if (!Countingwand.isCountingwand(event.getPlayer().getInventory().getItemInMainHand())) {
if (!Countingwand.isCountingwand(event.getPlayer(), event.getPlayer().getInventory().getItemInMainHand())) {
return;
}
@ -46,7 +46,7 @@ public class CountingwandListener implements Listener {
@EventHandler
public void onPlayerInteract(final PlayerInteractEvent event) {
if (!Countingwand.isCountingwand(event.getItem())) {
if (!Countingwand.isCountingwand(event.getPlayer(), event.getItem())) {
return;
}