Add AutoStart to multilingual
Dieser Commit ist enthalten in:
Ursprung
e1f77b47b3
Commit
94c5b40b55
@ -87,6 +87,17 @@ REGION_TYPE_NORMAL = Normal
|
|||||||
REGION_TYPE_BUILD = Baubereich
|
REGION_TYPE_BUILD = Baubereich
|
||||||
REGION_TYPE_ONLY_TB = Testblock
|
REGION_TYPE_ONLY_TB = Testblock
|
||||||
|
|
||||||
|
# AutoStart
|
||||||
|
AUTOSTART_COMMAND_HELP = §8/§etimer §8- §7Legt den AutostartTimer ins Inventar
|
||||||
|
AUTOSTART_ITEM_NAME = §eAutostartTimer
|
||||||
|
AUTOSTART_ITEM_LORE = §eRechtsklick Block §8- §7Starte den Timer
|
||||||
|
AUTOSTART_MESSAGE_NO-REGION = §cDu befindest dich derzeit in keiner Region
|
||||||
|
AUTOSTART_MESSAGE_RESET = §eDer AutostartTimer wurde zurückgesetzt
|
||||||
|
AUTOSTART_MESSAGE_START = §eAutostartTimer gestartet
|
||||||
|
AUTOSTART_MESSAGE_RESULT1 = §eZeit §7bis zur §eExplosion §7am Gegner§8:§e {0}
|
||||||
|
AUTOSTART_MESSAGE_RESULT2 = §eZeitdifferenz in ticks §7bis 60 Sekunden§8:§e {0}
|
||||||
|
AUTOSTART_MESSAGE_RESULT3 = §7Positiv, wenn zu wenig, negativ wenn zu viel
|
||||||
|
|
||||||
# GUI
|
# GUI
|
||||||
GUI_EDITOR_ITEM-NAME=§eGui Editor
|
GUI_EDITOR_ITEM-NAME=§eGui Editor
|
||||||
GUI_EXPORT_CODE=§eDein Gui-Code:
|
GUI_EXPORT_CODE=§eDein Gui-Code:
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.autostart;
|
package de.steamwar.bausystem.features.autostart;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
@ -38,12 +39,12 @@ public class AutoStartCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player p, String... args) {
|
public void genericHelp(Player p, String... args) {
|
||||||
p.sendMessage("§8/§etimer §8- §7Legt den AutostartTimer ins Inventar");
|
BauSystem.MESSAGE.send("AUTOSTART_COMMAND_HELP", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void genericCommand(Player p) {
|
public void genericCommand(Player p) {
|
||||||
SWUtils.giveItemToPlayer(p, AutostartListener.WAND);
|
SWUtils.giveItemToPlayer(p, AutostartListener.getWandItem(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,11 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.autostart;
|
package de.steamwar.bausystem.features.autostart;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -40,7 +41,7 @@ public class AutoStartGuiItem extends BauGuiItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(Player player) {
|
public ItemStack getItem(Player player) {
|
||||||
return new SWItem(Material.FIREWORK_STAR, "§eAutostartTimer", Arrays.asList("§eRechtsklick Block §8- §7Starte den Timer"), false, null).getItemStack();
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,14 +46,16 @@ import java.util.Map;
|
|||||||
@Linked(LinkageType.LISTENER)
|
@Linked(LinkageType.LISTENER)
|
||||||
public class AutostartListener implements Listener {
|
public class AutostartListener implements Listener {
|
||||||
|
|
||||||
public static final ItemStack WAND = new SWItem(Material.BLAZE_ROD, "§eAutostartTimer", Arrays.asList("§eRechtsklick Block §8- §7Starte den Timer"), false, null).getItemStack();
|
public static ItemStack getWandItem(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();
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Map<Region, Long> regionStartTime = new HashMap<>();
|
private Map<Region, Long> regionStartTime = new HashMap<>();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (!AutostartListener.WAND.isSimilar(event.getItem())) {
|
if (!AutostartListener.getWandItem(event.getPlayer()).isSimilar(event.getItem())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getClickedBlock() == null) {
|
if (event.getClickedBlock() == null) {
|
||||||
@ -62,17 +64,17 @@ public class AutostartListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Region region = Region.getRegion(event.getClickedBlock().getLocation());
|
Region region = Region.getRegion(event.getClickedBlock().getLocation());
|
||||||
if (region.isGlobal()) {
|
if (region.isGlobal()) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
|
BauSystem.MESSAGE.send("AUTOSTART_MESSAGE_NO-REGION", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!region.hasType(RegionType.TESTBLOCK)) {
|
if (!region.hasType(RegionType.TESTBLOCK)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
|
BauSystem.MESSAGE.send("AUTOSTART_MESSAGE_NO-REGION", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (regionStartTime.containsKey(region)) {
|
if (regionStartTime.containsKey(region)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§eDer AutostartTimer wurde zurückgesetzt");
|
BauSystem.MESSAGE.send("AUTOSTART_MESSAGE_RESET", player);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§eAutostartTimer gestartet");
|
BauSystem.MESSAGE.send("AUTOSTART_MESSAGE_START", player);
|
||||||
}
|
}
|
||||||
regionStartTime.put(region, TPSUtils.currentTick.get());
|
regionStartTime.put(region, TPSUtils.currentTick.get());
|
||||||
}
|
}
|
||||||
@ -88,9 +90,9 @@ public class AutostartListener implements Listener {
|
|||||||
if (!region.hasType(RegionType.TESTBLOCK)) return;
|
if (!region.hasType(RegionType.TESTBLOCK)) return;
|
||||||
if (!region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return;
|
if (!region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return;
|
||||||
long tickDiff = TPSUtils.currentTick.get() - regionStartTime.remove(region);
|
long tickDiff = TPSUtils.currentTick.get() - regionStartTime.remove(region);
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§eZeit §7bis zur §eExplosion §7am Gegner§8:§e " + new SimpleDateFormat("mm:ss SSSS").format(new Date(tickDiff * 50)));
|
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT1", new SimpleDateFormat("mm:ss SSSS").format(new Date(tickDiff * 50)));
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§eZeitdifferenz in ticks §7bis 60 Sekunden§8:§e " + (1200 - tickDiff));
|
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT2", (1200 - tickDiff));
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§7Positiv, wenn zu wenig, negativ wenn zu viel");
|
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT3");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ import de.steamwar.bausystem.region.utils.RegionType;
|
|||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
if(checkGlobalRegion(region, p)) return;
|
if(checkGlobalRegion(region, p)) return;
|
||||||
|
|
||||||
if (region.undo()) {
|
if (region.undo()) {
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§7Letzte Aktion rückgangig gemacht");
|
RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Letzte Aktion rückgangig gemacht");
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cNichts zum rückgängig machen");
|
p.sendMessage(BauSystem.PREFIX + "§cNichts zum rückgängig machen");
|
||||||
}
|
}
|
||||||
@ -73,7 +72,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (region.redo()) {
|
if (region.redo()) {
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§7Letzte Aktion wiederhohlt");
|
RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Letzte Aktion wiederhohlt");
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cNichts zum wiederhohlen");
|
p.sendMessage(BauSystem.PREFIX + "§cNichts zum wiederhohlen");
|
||||||
}
|
}
|
||||||
@ -97,7 +96,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
region.reset(null, RegionType.NORMAL, RegionExtensionType.NORMAL, true);
|
region.reset(null, RegionType.NORMAL, RegionExtensionType.NORMAL, true);
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§7Region zurückgesetzt");
|
RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Region zurückgesetzt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
||||||
@ -117,7 +116,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
region.reset(schem, RegionType.NORMAL, RegionExtensionType.NORMAL, true);
|
region.reset(schem, RegionType.NORMAL, RegionExtensionType.NORMAL, true);
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§7Region zurückgesetzt");
|
RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Region zurückgesetzt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed reset", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed reset", e);
|
||||||
|
@ -36,7 +36,7 @@ public class ResetCommand extends SWCommand {
|
|||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
try {
|
try {
|
||||||
region.reset(null, RegionType.NORMAL);
|
region.reset(null, RegionType.NORMAL);
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§7Region zurückgesetzt");
|
RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Region zurückgesetzt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
||||||
@ -55,7 +55,7 @@ public class ResetCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
region.reset(schem, RegionType.NORMAL);
|
region.reset(schem, RegionType.NORMAL);
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§7Region zurückgesetzt");
|
RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Region zurückgesetzt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed reset", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed reset", e);
|
||||||
|
@ -47,7 +47,7 @@ public class TestblockCommand extends SWCommand {
|
|||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
try {
|
try {
|
||||||
region.reset(RegionType.TESTBLOCK, regionExtensionType);
|
region.reset(RegionType.TESTBLOCK, regionExtensionType);
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§7Testblock zurückgesetzt");
|
RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Testblock zurückgesetzt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");
|
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
||||||
@ -76,7 +76,7 @@ public class TestblockCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
region.reset(schem, RegionType.TESTBLOCK, regionExtensionType);
|
region.reset(schem, RegionType.TESTBLOCK, regionExtensionType);
|
||||||
RegionUtils.message(region, BauSystem.PREFIX + "§7Testblock zurückgesetzt");
|
RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Testblock zurückgesetzt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");
|
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
||||||
|
@ -2,6 +2,7 @@ package de.steamwar.bausystem.region;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.region.loader.RegionLoader;
|
import de.steamwar.bausystem.region.loader.RegionLoader;
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
@ -27,7 +28,7 @@ public class RegionUtils {
|
|||||||
.forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
.forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void message(Region region, String s) {
|
public static void messageOLD(Region region, String s) {
|
||||||
Bukkit.getOnlinePlayers()
|
Bukkit.getOnlinePlayers()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
|
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
|
||||||
@ -35,6 +36,16 @@ public class RegionUtils {
|
|||||||
.forEach(player -> player.sendMessage(s));
|
.forEach(player -> player.sendMessage(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void message(Region region, String message, Object... objects) {
|
||||||
|
Bukkit.getOnlinePlayers()
|
||||||
|
.stream()
|
||||||
|
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
|
||||||
|
.filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal())
|
||||||
|
.forEach(player -> {
|
||||||
|
BauSystem.MESSAGE.send(message, player, objects);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static void message(Region region, Function<Player, String> function) {
|
public static void message(Region region, Function<Player, String> function) {
|
||||||
Bukkit.getOnlinePlayers()
|
Bukkit.getOnlinePlayers()
|
||||||
.stream()
|
.stream()
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren