feat: add language file
This commit is contained in:
parent
0d6ca34a69
commit
0a964896e6
16 changed files with 183 additions and 35 deletions
|
@ -30,6 +30,7 @@ import de.cliffbreak.varo.managers.GameTimeManager;
|
||||||
import de.cliffbreak.varo.managers.NPCManager;
|
import de.cliffbreak.varo.managers.NPCManager;
|
||||||
import de.cliffbreak.varo.managers.TeamManager;
|
import de.cliffbreak.varo.managers.TeamManager;
|
||||||
import de.cliffbreak.varo.utils.BanUtils;
|
import de.cliffbreak.varo.utils.BanUtils;
|
||||||
|
import de.cliffbreak.varo.utils.LangUtils;
|
||||||
import de.cliffbreak.varo.utils.MessageUtils;
|
import de.cliffbreak.varo.utils.MessageUtils;
|
||||||
import de.cliffbreak.varo.utils.PlayerCache;
|
import de.cliffbreak.varo.utils.PlayerCache;
|
||||||
import de.cliffbreak.varo.utils.PlayerUtils;
|
import de.cliffbreak.varo.utils.PlayerUtils;
|
||||||
|
@ -50,6 +51,7 @@ public class Varo extends JavaPlugin {
|
||||||
private GameTimeManager gameTimeManager;
|
private GameTimeManager gameTimeManager;
|
||||||
private PlayerUtils playerUtils;
|
private PlayerUtils playerUtils;
|
||||||
private BorderManager borderManager;
|
private BorderManager borderManager;
|
||||||
|
private LangUtils langUtils;
|
||||||
|
|
||||||
private boolean canCreatePortal = false;
|
private boolean canCreatePortal = false;
|
||||||
|
|
||||||
|
@ -71,6 +73,7 @@ public class Varo extends JavaPlugin {
|
||||||
this.gameTimeManager = new GameTimeManager(this);
|
this.gameTimeManager = new GameTimeManager(this);
|
||||||
this.playerUtils = new PlayerUtils(this);
|
this.playerUtils = new PlayerUtils(this);
|
||||||
this.borderManager = new BorderManager(this);
|
this.borderManager = new BorderManager(this);
|
||||||
|
this.langUtils = new LangUtils();
|
||||||
|
|
||||||
this.config.addDefault("Varo.Start", 1590393600000f);
|
this.config.addDefault("Varo.Start", 1590393600000f);
|
||||||
this.config.addDefault("Varo.Debug", false);
|
this.config.addDefault("Varo.Debug", false);
|
||||||
|
@ -89,14 +92,14 @@ public class Varo extends JavaPlugin {
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerLoginListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerLoginListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerJoinQuitListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerJoinQuitListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerClientOptionsChangeListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerClientOptionsChangeListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerResourcePackStatusListener(), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerResourcePackStatusListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new ChatListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new ChatListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new EntityRegainHealthListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new EntityRegainHealthListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerDeathListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerDeathListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new BannedItemListener(), this);
|
this.getServer().getPluginManager().registerEvents(new BannedItemListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new BannedActionListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new BannedActionListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerInteractNPCListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerInteractNPCListener(this), this);
|
||||||
this.getServer().getPluginManager().registerEvents(new InventoryClickListener(), this);
|
this.getServer().getPluginManager().registerEvents(new InventoryClickListener(this), this);
|
||||||
|
|
||||||
this.getCommand("varo").setExecutor(new VaroCommand(this));
|
this.getCommand("varo").setExecutor(new VaroCommand(this));
|
||||||
this.getCommand("varo").setTabCompleter(new VaroTabCompleter(this));
|
this.getCommand("varo").setTabCompleter(new VaroTabCompleter(this));
|
||||||
|
@ -180,4 +183,8 @@ public class Varo extends JavaPlugin {
|
||||||
public BorderManager getBorderManager() {
|
public BorderManager getBorderManager() {
|
||||||
return this.borderManager;
|
return this.borderManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LangUtils getLangUtils() {
|
||||||
|
return this.langUtils;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class CoordsCommand implements CommandExecutor {
|
||||||
}.runTaskTimerAsynchronously(this.plugin, 0, 20));
|
}.runTaskTimerAsynchronously(this.plugin, 0, 20));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("§c§lFehler:§r§c Dieses Kommando kann nur durch einen Spieler ausgeführt werden.");
|
sender.sendMessage(this.plugin.getLangUtils().get("Error.NoPlayer"));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent.Reason;
|
import org.bukkit.event.inventory.InventoryCloseEvent.Reason;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.JSONValue;
|
import org.json.simple.JSONValue;
|
||||||
|
|
|
@ -48,7 +48,8 @@ public class MessageListener extends ListenerAdapter {
|
||||||
final String id = message.getMentionedMembers().get(0).getId();
|
final String id = message.getMentionedMembers().get(0).getId();
|
||||||
final String uuid = this.plugin.getTeamManager().getPlayerByDiscordId(id);
|
final String uuid = this.plugin.getTeamManager().getPlayerByDiscordId(id);
|
||||||
final int kills = this.plugin.getDatabase().getKills(uuid);
|
final int kills = this.plugin.getDatabase().getKills(uuid);
|
||||||
channel.sendMessage("Der Spieler <@!" + id + "> hat momentan " + kills + " Kills.").queue();
|
channel.sendMessage(this.plugin.getLangUtils().get("Discord.PlayerStats").replace("%id%", id)
|
||||||
|
.replace("%kills%", "" + kills)).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,8 +29,7 @@ public class BannedActionListener implements Listener {
|
||||||
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||||
if (e.getClickedBlock().getType().equals(Material.OBSIDIAN)
|
if (e.getClickedBlock().getType().equals(Material.OBSIDIAN)
|
||||||
&& e.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.FLINT_AND_STEEL)) {
|
&& e.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.FLINT_AND_STEEL)) {
|
||||||
e.getPlayer()
|
e.getPlayer().sendMessage(this.plugin.getLangUtils().get("Error.NetherPortalCreate"));
|
||||||
.sendMessage("§cEin Nether-Portal kann nicht erzeugt werden.\n §rGehe hierzu in die Mitte.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,22 @@ import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
|
||||||
|
import de.cliffbreak.varo.Varo;
|
||||||
|
|
||||||
public class BannedItemListener implements Listener {
|
public class BannedItemListener implements Listener {
|
||||||
|
|
||||||
|
private final Varo plugin;
|
||||||
|
|
||||||
|
public BannedItemListener(final Varo plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityPickupItem(final EntityPickupItemEvent e) {
|
public void onEntityPickupItem(final EntityPickupItemEvent e) {
|
||||||
if (e.getEntity() instanceof Player) {
|
if (e.getEntity() instanceof Player) {
|
||||||
final Material mat = e.getItem().getItemStack().getType();
|
final Material mat = e.getItem().getItemStack().getType();
|
||||||
if (isForbiddenMaterial(mat)) {
|
if (isForbiddenMaterial(mat)) {
|
||||||
e.getEntity().sendMessage("§cVerbotenes Item wurde entfernt.");
|
e.getEntity().sendMessage(this.plugin.getLangUtils().get("Error.BannedItemPickup"));
|
||||||
e.getItem().remove();
|
e.getItem().remove();
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +35,7 @@ public class BannedItemListener implements Listener {
|
||||||
return;
|
return;
|
||||||
final Material mat = e.getCurrentItem().getType();
|
final Material mat = e.getCurrentItem().getType();
|
||||||
if (isForbiddenMaterial(mat)) {
|
if (isForbiddenMaterial(mat)) {
|
||||||
e.getWhoClicked().sendMessage("§cVerbotenes Item kann nicht ins Inventar verschoben werden.");
|
e.getWhoClicked().sendMessage(this.plugin.getLangUtils().get("Error.BannedItemMove"));
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,16 @@ import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
|
|
||||||
|
import de.cliffbreak.varo.Varo;
|
||||||
|
|
||||||
public class InventoryClickListener implements Listener {
|
public class InventoryClickListener implements Listener {
|
||||||
|
|
||||||
|
private final Varo plugin;
|
||||||
|
|
||||||
|
public InventoryClickListener(final Varo plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(final InventoryClickEvent e) {
|
public void onInventoryClick(final InventoryClickEvent e) {
|
||||||
if (e.getInventory().getType().equals(InventoryType.BREWING)) {
|
if (e.getInventory().getType().equals(InventoryType.BREWING)) {
|
||||||
|
@ -20,7 +28,7 @@ public class InventoryClickListener implements Listener {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
e.getWhoClicked().sendMessage("§cEs kann nur ein Heilungstrank gebraut werden.");
|
e.getWhoClicked().sendMessage(this.plugin.getLangUtils().get("Error.Brew"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import de.cliffbreak.varo.Varo;
|
import de.cliffbreak.varo.Varo;
|
||||||
|
@ -23,7 +24,7 @@ public class PlayerDeathListener implements Listener {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
e.getEntity().kickPlayer("§4Du bist gestorben.\n \n§cDamit bist du aus §eVaro§c ausgeschieden.");
|
e.getEntity().kickPlayer(plugin.getLangUtils().get("Service.BannedDead"));
|
||||||
}
|
}
|
||||||
}.runTaskLater(this.plugin, 20);
|
}.runTaskLater(this.plugin, 20);
|
||||||
final EntityDamageEvent damageCause = e.getEntity().getLastDamageCause();
|
final EntityDamageEvent damageCause = e.getEntity().getLastDamageCause();
|
||||||
|
@ -39,54 +40,68 @@ public class PlayerDeathListener implements Listener {
|
||||||
switch (damageCause.getCause()) {
|
switch (damageCause.getCause()) {
|
||||||
case BLOCK_EXPLOSION:
|
case BLOCK_EXPLOSION:
|
||||||
// TNT
|
// TNT
|
||||||
if (killer == null) {
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.BLOCK_EXPLOSION));
|
||||||
e.setDeathMessage("Hier die Todesnachricht einfügen..");
|
|
||||||
} else {
|
|
||||||
e.setDeathMessage("Hier die Todesnachricht einfügen.. mit " + killer + ".");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case CONTACT:
|
case CONTACT:
|
||||||
// Cactus
|
// Cactus
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.CONTACT));
|
||||||
break;
|
break;
|
||||||
case DROWNING:
|
case DROWNING:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.DROWNING));
|
||||||
break;
|
break;
|
||||||
case ENTITY_EXPLOSION:
|
case ENTITY_EXPLOSION:
|
||||||
// Creeper
|
// Creeper
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.ENTITY_EXPLOSION));
|
||||||
break;
|
break;
|
||||||
case ENTITY_ATTACK:
|
case ENTITY_ATTACK:
|
||||||
case ENTITY_SWEEP_ATTACK:
|
case ENTITY_SWEEP_ATTACK:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.ENTITY_ATTACK));
|
||||||
break;
|
break;
|
||||||
case FALL:
|
case FALL:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.FALL));
|
||||||
break;
|
break;
|
||||||
case FALLING_BLOCK:
|
case FALLING_BLOCK:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.FALLING_BLOCK));
|
||||||
break;
|
break;
|
||||||
case FIRE:
|
case FIRE:
|
||||||
case FIRE_TICK:
|
case FIRE_TICK:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.FIRE));
|
||||||
break;
|
break;
|
||||||
case HOT_FLOOR:
|
case HOT_FLOOR:
|
||||||
// Magma Block
|
// Magma Block
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.HOT_FLOOR));
|
||||||
break;
|
break;
|
||||||
case LAVA:
|
case LAVA:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.LAVA));
|
||||||
break;
|
break;
|
||||||
case LIGHTNING:
|
case LIGHTNING:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.LIGHTNING));
|
||||||
break;
|
break;
|
||||||
case MAGIC:
|
case MAGIC:
|
||||||
// Potion (should be impossible)
|
// Potion (should be impossible)
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.MAGIC));
|
||||||
break;
|
break;
|
||||||
case POISON:
|
case POISON:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.POISON));
|
||||||
break;
|
break;
|
||||||
case PROJECTILE:
|
case PROJECTILE:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.PROJECTILE));
|
||||||
break;
|
break;
|
||||||
case STARVATION:
|
case STARVATION:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.STARVATION));
|
||||||
break;
|
break;
|
||||||
case SUFFOCATION:
|
case SUFFOCATION:
|
||||||
// Border damage or sand/gravel
|
// Border damage or sand/gravel
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.SUFFOCATION));
|
||||||
break;
|
break;
|
||||||
case THORNS:
|
case THORNS:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.THORNS));
|
||||||
break;
|
break;
|
||||||
case VOID:
|
case VOID:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.VOID));
|
||||||
break;
|
break;
|
||||||
case WITHER:
|
case WITHER:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.WITHER));
|
||||||
break;
|
break;
|
||||||
case CRAMMING: // Very rare so handle as default death
|
case CRAMMING: // Very rare so handle as default death
|
||||||
case CUSTOM: // No custom damage provider so impossible
|
case CUSTOM: // No custom damage provider so impossible
|
||||||
|
@ -96,6 +111,7 @@ public class PlayerDeathListener implements Listener {
|
||||||
case MELTING: // No snowman so impossible
|
case MELTING: // No snowman so impossible
|
||||||
case SUICIDE: // No access to /kill command
|
case SUICIDE: // No access to /kill command
|
||||||
default:
|
default:
|
||||||
|
e.setDeathMessage(this.getDeathMessage(e.getEntity(), killer, DamageCause.CUSTOM)); // CUSTOM == default
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,4 +125,13 @@ public class PlayerDeathListener implements Listener {
|
||||||
+ this.plugin.getTeamManager().getDiscordIdByPlayer(e.getEntity()) + "> ist gestorben.");
|
+ this.plugin.getTeamManager().getDiscordIdByPlayer(e.getEntity()) + "> ist gestorben.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDeathMessage(final Player victim, final Player killer, final DamageCause cause) {
|
||||||
|
if (killer == null) {
|
||||||
|
return this.plugin.getLangUtils().get("Death." + cause.toString()).replace("%player%", victim.getName());
|
||||||
|
} else {
|
||||||
|
return this.plugin.getLangUtils().get("Death." + cause.toString() + "killer")
|
||||||
|
.replace("%player%", victim.getName()).replace("%killer%", killer.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -49,8 +49,7 @@ public class PlayerJoinQuitListener implements Listener {
|
||||||
this.plugin.getNPCManager().syncClones(e.getPlayer());
|
this.plugin.getNPCManager().syncClones(e.getPlayer());
|
||||||
|
|
||||||
if (!this.plugin.getTeamManager().setTeam(e.getPlayer())) {
|
if (!this.plugin.getTeamManager().setTeam(e.getPlayer())) {
|
||||||
e.getPlayer().kickPlayer(
|
e.getPlayer().kickPlayer(this.plugin.getLangUtils().get("Error.NoTeam"));
|
||||||
"§4§lFehler!\n \n§cDu bist keinem Team zugeordnet.\n \n§r§7Kontaktiere bitte die §f§l@Admins §r§7auf dem Discord-Server.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ public class PlayerLoginListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLogin(final PlayerLoginEvent e) {
|
public void onPlayerLogin(final PlayerLoginEvent e) {
|
||||||
if (this.plugin.getBanUtils().isBanned(e.getPlayer().getUniqueId())) {
|
if (this.plugin.getBanUtils().isBanned(e.getPlayer().getUniqueId())) {
|
||||||
e.disallow(Result.KICK_BANNED, "§4Du bist gestorben.\n \n§cDamit bist du aus §eVaro§c ausgeschieden.");
|
e.disallow(Result.KICK_BANNED, this.plugin.getLangUtils().get("Service.BannedDead"));
|
||||||
} else if (!this.plugin.getGameTimeManager().canLogin()) {
|
} else if (!this.plugin.getGameTimeManager().canLogin()) {
|
||||||
e.disallow(Result.KICK_OTHER, "Außerhalb der Playtime");
|
e.disallow(Result.KICK_OTHER, this.plugin.getLangUtils().get("Service.KickNoPlayTime"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,16 +5,22 @@ import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
||||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status;
|
import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status;
|
||||||
|
|
||||||
|
import de.cliffbreak.varo.Varo;
|
||||||
|
|
||||||
public class PlayerResourcePackStatusListener implements Listener {
|
public class PlayerResourcePackStatusListener implements Listener {
|
||||||
|
|
||||||
|
private final Varo plugin;
|
||||||
|
|
||||||
|
public PlayerResourcePackStatusListener(final Varo plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerResourcePackStatus(PlayerResourcePackStatusEvent e) {
|
public void onPlayerResourcePackStatus(PlayerResourcePackStatusEvent e) {
|
||||||
if (e.getStatus().equals(Status.DECLINED)) {
|
if (e.getStatus().equals(Status.DECLINED)) {
|
||||||
e.getPlayer().kickPlayer(
|
e.getPlayer().kickPlayer(this.plugin.getLangUtils().get("Error.ResourcepackDeclined"));
|
||||||
"§4Du wurdest gekickt.\n \n§r§7Aktiviere §f§lRessourcepacks§r§7 in den\n§f§lServer-Einstellungen§r§7, um spielen zu können.\n \nBei Problemen kontaktiere die §f§l@Admins §r§7auf dem Discord-Server.");
|
|
||||||
} else if (e.getStatus().equals(Status.FAILED_DOWNLOAD)) {
|
} else if (e.getStatus().equals(Status.FAILED_DOWNLOAD)) {
|
||||||
e.getPlayer().kickPlayer(
|
e.getPlayer().kickPlayer(this.plugin.getLangUtils().get("Error.ResourcepackFailed"));
|
||||||
"§4Du wurdest gekickt.\n \n§r§7Das §f§lServer-Ressourcepack §r§7konnte\n§r§7nicht erfolgreich heruntergeladen werden.\n \nBitte versuche es erneut.\n \nBei Problemen kontaktiere die §f§l@Admins §r§7auf dem Discord-Server.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,6 @@ public class BorderManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBorderSize(final int size, final int time) {
|
private void setBorderSize(final int size, final int time) {
|
||||||
System.out.println("Size: " + size);
|
|
||||||
System.out.println("Time: " + time);
|
|
||||||
for (final World world : Bukkit.getWorlds()) {
|
for (final World world : Bukkit.getWorlds()) {
|
||||||
final Environment env = world.getEnvironment();
|
final Environment env = world.getEnvironment();
|
||||||
if (env.equals(Environment.THE_END))
|
if (env.equals(Environment.THE_END))
|
||||||
|
@ -65,9 +63,8 @@ public class BorderManager {
|
||||||
size = size - 110; // 55*2 for both directions
|
size = size - 110; // 55*2 for both directions
|
||||||
this.plugin.getConfig().set("Varo.Border.NextSize", size);
|
this.plugin.getConfig().set("Varo.Border.NextSize", size);
|
||||||
this.plugin.saveConfig();
|
this.plugin.saveConfig();
|
||||||
this.plugin.getDiscordBot()
|
this.plugin.getDiscordBot().broadcastMessage(
|
||||||
.broadcastMessage("@everyone In 30 Minuten geht es los!\nDie Border schrumpft heute auf " + size / 2
|
this.plugin.getLangUtils().get("Discord.BorderUpdate").replaceAll("%size%", "" + size / 2));
|
||||||
+ "x" + size / 2 + " Blöcke.");
|
|
||||||
return curr.atZone(ZoneId.systemDefault()).toLocalDateTime();
|
return curr.atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class GameTimeManager {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (isPlayTimeOver()) {
|
if (isPlayTimeOver()) {
|
||||||
for (final Player p : Bukkit.getOnlinePlayers()) {
|
for (final Player p : Bukkit.getOnlinePlayers()) {
|
||||||
p.kickPlayer("Spielzeit abgelaufen");
|
p.kickPlayer(plugin.getLangUtils().get("Service.KickPlayTimeOver"));
|
||||||
}
|
}
|
||||||
this.cancel();
|
this.cancel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,7 @@ public class NPCManager {
|
||||||
}.runTask(this.plugin); // Run Task in sync to be thread safe
|
}.runTask(this.plugin); // Run Task in sync to be thread safe
|
||||||
|
|
||||||
this.plugin.getBanUtils().addBan(npc.getUniqueID());
|
this.plugin.getBanUtils().addBan(npc.getUniqueID());
|
||||||
|
// TODO:
|
||||||
Bukkit.broadcastMessage("TODO: Player(" + "??" + ") killed AFK Player (" + npc.getName() + ")");
|
Bukkit.broadcastMessage("TODO: Player(" + "??" + ") killed AFK Player (" + npc.getName() + ")");
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
|
|
98
varo/src/main/java/de/cliffbreak/varo/utils/LangUtils.java
Normal file
98
varo/src/main/java/de/cliffbreak/varo/utils/LangUtils.java
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
package de.cliffbreak.varo.utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import de.cliffbreak.varo.Varo;
|
||||||
|
|
||||||
|
public class LangUtils {
|
||||||
|
private final File file;
|
||||||
|
private final YamlConfiguration config;
|
||||||
|
|
||||||
|
public LangUtils() {
|
||||||
|
this.file = new File("plugins/CliffbreakVaro", "lang.yml");
|
||||||
|
this.config = YamlConfiguration.loadConfiguration(this.file);
|
||||||
|
|
||||||
|
this.config.addDefault("Service.KickNoPlayTime", "Service.KickNoPlayTime");
|
||||||
|
this.config.addDefault("Service.KickPlayTimeOver", "Service.KickPlayTimeOver");
|
||||||
|
this.config.addDefault("Service.LoadingTitle", "Varo 2020");
|
||||||
|
this.config.addDefault("Service.LoadingSubTitle", "Bitte warte, bis das Spiel geladen hat...");
|
||||||
|
this.config.addDefault("Service.LoadingCountdown", "§r§l Noch: %02d:%02d");
|
||||||
|
this.config.addDefault("Service.BannedDead",
|
||||||
|
"§4Du bist gestorben.\n \n§cDamit bist du aus §eVaro§c ausgeschieden.");
|
||||||
|
this.config.addDefault("Error.NoPlayer",
|
||||||
|
"§c§lFehler:§r§c Dieses Kommando kann nur durch einen Spieler ausgeführt werden.");
|
||||||
|
this.config.addDefault("Error.ResourcepackDeclined",
|
||||||
|
"§4Du wurdest gekickt.\n \n§r§7Aktiviere §f§lRessourcepacks§r§7 in den\n§f§lServer-Einstellungen§r§7, um spielen zu können.\n \nBei Problemen kontaktiere die §f§l@Admins §r§7auf dem Discord-Server.");
|
||||||
|
this.config.addDefault("Error.ResourcepackFailed",
|
||||||
|
"§4Du wurdest gekickt.\n \n§r§7Das §f§lServer-Ressourcepack §r§7konnte\n§r§7nicht erfolgreich heruntergeladen werden.\n \nBitte versuche es erneut.\n \nBei Problemen kontaktiere die §f§l@Admins §r§7auf dem Discord-Server.");
|
||||||
|
this.config.addDefault("Error.NoTeam",
|
||||||
|
"§4§lFehler!\n \n§cDu bist keinem Team zugeordnet.\n \n§r§7Kontaktiere bitte die §f§l@Admins §r§7auf dem Discord-Server.");
|
||||||
|
this.config.addDefault("Error.Brew", "§cEs kann nur ein Heilungstrank gebraut werden.");
|
||||||
|
this.config.addDefault("Error.BannedItemMove",
|
||||||
|
"§cVerbotenes Item kann nicht ins Inventar verschoben werden.");
|
||||||
|
this.config.addDefault("Error.BannedItemPickup", "§cVerbotenes Item wurde entfernt.");
|
||||||
|
this.config.addDefault("Error.NetherPortalCreate",
|
||||||
|
"§cEin Nether-Portal kann nicht erzeugt werden.\n §rGehe hierzu in die Mitte.");
|
||||||
|
this.config.addDefault("Discord.BorderUpdate",
|
||||||
|
"@everyone In 30 Minuten geht es los!\nDie Border schrumpft heute auf %size%x%size% Blöcke.");
|
||||||
|
this.config.addDefault("Discord.PlayerStats", "Der Spieler <@!%id%> hat momentan %kills% Kills.");
|
||||||
|
this.config.addDefault("Death.CUSTOM", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.CUSTOMkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.BLOCK_EXPLOSION", "%player% ist explodiert.");
|
||||||
|
this.config.addDefault("Death.BLOCK_EXPLOSIONkiller",
|
||||||
|
"%player% ist im Kampf gegen %killer% explodiert.");
|
||||||
|
this.config.addDefault("Death.CONTACT", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.CONTACTkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.DROWNING", "%player% ist ertrunken.");
|
||||||
|
this.config.addDefault("Death.DROWNINGkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.ENTITY_EXPLOSION", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.ENTITY_EXPLOSIONkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.ENTITY_ATTACK", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.ENTITY_ATTACKkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.FALL", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.FALLkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.FALLING_BLOCK", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.FALLING_BLOCKkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.FIRE", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.FIREkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.HOT_FLOOR", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.HOT_FLOORkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.LAVA", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.LAVAkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.LIGHTNING", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.LIGHTNINGkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.MAGIC", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.MAGICkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.POISON", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.POISONkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.PROJECTILE", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.PROJECTILEkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.STARVATION", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.STARVATIONkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.SUFFOCATION", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.SUFFOCATIONkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.THORNS", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.THORNSkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.VOID", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.VOIDkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.addDefault("Death.WITHER", "%player% ist gestorben.");
|
||||||
|
this.config.addDefault("Death.WITHERkiller", "%player% wurde von %killer% getötet.");
|
||||||
|
this.config.options().copyDefaults(true);
|
||||||
|
this.saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String get(final String path) {
|
||||||
|
return this.config.getString(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveConfig() {
|
||||||
|
try {
|
||||||
|
this.config.save(this.file);
|
||||||
|
} catch (final IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,8 +37,8 @@ public class PlayerUtils {
|
||||||
p.setGameMode(GameMode.SPECTATOR);
|
p.setGameMode(GameMode.SPECTATOR);
|
||||||
p.setFlying(true);
|
p.setFlying(true);
|
||||||
p.setFlySpeed(0.0f);
|
p.setFlySpeed(0.0f);
|
||||||
final Title title = new Title("Varo 2020", "Bitte warte, bis das Spiel geladen hat...", 20, (seconds - 2) * 20,
|
final Title title = new Title(this.plugin.getLangUtils().get("Service.LoadingTitle"),
|
||||||
20);
|
this.plugin.getLangUtils().get("Service.LoadingSubTitle"), 20, (seconds - 2) * 20, 20);
|
||||||
p.sendTitle(title);
|
p.sendTitle(title);
|
||||||
|
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, seconds * 20, 1, false, false));
|
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, seconds * 20, 1, false, false));
|
||||||
|
@ -59,8 +59,8 @@ public class PlayerUtils {
|
||||||
this.cancel();
|
this.cancel();
|
||||||
p.sendActionBar("");
|
p.sendActionBar("");
|
||||||
} else {
|
} else {
|
||||||
p.sendActionBar(
|
p.sendActionBar(String.format(plugin.getLangUtils().get("Service.LoadingCountdown"),
|
||||||
String.format("§r§l Noch: %02d:%02d", (int) Math.floor(seconds / 60), seconds % 60));
|
(int) Math.floor(seconds / 60), seconds % 60));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskTimer(this.plugin, 0, 20);
|
}.runTaskTimer(this.plugin, 0, 20);
|
||||||
|
|
Loading…
Reference in a new issue