Sign localizations - resolves #228

This commit is contained in:
Daniel Saukel 2018-04-22 16:34:51 +02:00
parent a207333536
commit 7bbee750b4
11 changed files with 49 additions and 46 deletions

View File

@ -1,9 +1,9 @@
![DungeonsXL](http://feuerstern.bplaced.net/ressourcen/logos/DungeonsXL.png)
[![Builds](http://feuerstern.bplaced.net/ressourcen/buttons/Builds.png)](http://feuerstern.bplaced.net/repo/io/github/dre2n/dungeonsxl)
[![Builds](http://feuerstern.bplaced.net/ressourcen/buttons/Builds.png)](http://erethon.de/repo/de/erethon/dungeonsxl)
[![Wiki](http://feuerstern.bplaced.net/ressourcen/buttons/Wiki.png)](../../wiki/)
[![Issues](http://feuerstern.bplaced.net/ressourcen/buttons/Issues.png)](../../issues/)
[![JavaDocs](http://feuerstern.bplaced.net/ressourcen/buttons/JavaDocs.png)](http://feuerstern.bplaced.net/javadocs/dxl/)
[![JavaDocs](http://feuerstern.bplaced.net/ressourcen/buttons/JavaDocs.png)](http://erethon.de/javadocs/dungeonsxl/)
[![MCStats](http://feuerstern.bplaced.net/ressourcen/buttons/MCStats.png)](http://mcstats.org/plugin/DungeonsXL/)
![Doge](https://i.imgflip.com/vtpyi.jpg)
@ -68,7 +68,7 @@ Building DungeonsXL from source requires [Apache Maven](https://maven.apache.org
Maven automatically fetches all dependencies and builds DungeonsXL; just run _build.bat_ or enter the command _mvn clean install_.
#### DRECommons
[DRECommons](https://github.com/DRE2N/DRECommons) is a util library for common tasks. DungeonsXL contains DRECommons 4.0.
[DRECommons](https://github.com/DRE2N/DRECommons) is a util library for common tasks. DungeonsXL contains DRECommons 4.1.
#### Caliburn API
[Caliburn](https://github.com/DRE2N/CaliburnAPI) is an API to read custom items and mobs from config files. DungeonsXL contains Caliburn Beta 0.3.

View File

@ -18,7 +18,7 @@ package io.github.dre2n.dungeonsxl.config;
import de.erethon.commons.chat.MessageUtil;
import de.erethon.commons.config.Message;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import de.erethon.commons.javaplugin.DREPlugin;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
@ -224,7 +224,21 @@ public enum DMessage implements Message {
SETTINGS_TITLE("Settings_Title", "&4Settings: &o"),
SETTINGS_TITLE_EDIT("Settings_Title_Edit", "Dungeon Setup"),
SETTINGS_TITLE_GLOBAL("Settings_Title_Global", "Global Configuration"),
SETTINGS_TITLE_PLAYER("Settings_Title_Player", "Player");
SETTINGS_TITLE_PLAYER("Settings_Title_Player", "Player"),
SIGN_END("sign.end", "&2END"),
SIGN_FLOOR_1("sign.floor.1", "&2ENTER"),
SIGN_FLOOR_2("sign.floor.2", "&2NEXT FLOOR"),
SIGN_GLOBAL_FULL("sign.global.full", "&4FULL"),
SIGN_GLOBAL_IS_PLAYING("sign.global.isPlaying", "&4IS PLAYING"),
SIGN_GLOBAL_JOIN_GAME("sign.global.joinGame", "&2JOIN GAME"),
SIGN_GLOBAL_JOIN_GROUP("sign.global.joinGroup", "&2JOIN GROUP"),
SIGN_GLOBAL_NEW_GAME("sign.global.newGame", "&2NEW GAME"),
SIGN_GLOBAL_NEW_GROUP("sign.global.newGroup", "&2NEW GROUP"),
SIGN_LEAVE("sign.leave", "&2LEAVE"),
SIGN_READY("sign.ready", "&2READY"),
SIGN_RESOURCE_PACK("sign.resourcePack", "&2DOWNLOAD"),
SIGN_WAVE_1("sign.wave.1", "&2START"),
SIGN_WAVE_2("sign.wave.2", "&2NEXT WAVE");
private String identifier;
private String message;
@ -247,7 +261,7 @@ public enum DMessage implements Message {
@Override
public String getMessage(String... args) {
return DungeonsXL.getInstance().getMessageConfig().getMessage(this, args);
return DREPlugin.getInstance().getMessageConfig().getMessage(this, args);
}
@Override
@ -260,13 +274,13 @@ public enum DMessage implements Message {
* Sends the message to the console.
*/
public void debug() {
MessageUtil.log(DungeonsXL.getInstance(), getMessage());
MessageUtil.log(DREPlugin.getInstance(), getMessage());
}
/* Statics */
/**
* @param identifer
* the identifer to set
* @param identifier
* the identifier to set
*/
public static Message getByIdentifier(String identifier) {
for (Message message : values()) {

View File

@ -28,7 +28,6 @@ import io.github.dre2n.dungeonsxl.world.DResourceWorld;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
@ -43,13 +42,6 @@ import org.bukkit.entity.Player;
*/
public class GameSign extends GlobalProtection {
// Sign Labels
public static final String IS_PLAYING = ChatColor.DARK_RED + "Is Playing";
public static final String FULL = ChatColor.DARK_RED + "Full";
public static final String JOIN_GAME = ChatColor.DARK_GREEN + "Join Game";
public static final String NEW_GAME = ChatColor.DARK_GREEN + "New Game";
// Variables
private Game[] games;
private Dungeon dungeon;
private int maxGroupsPerGame;
@ -158,13 +150,13 @@ public class GameSign extends GlobalProtection {
// Set Signs
if (game != null && game.getDGroups().size() > 0) {
if (game.getDGroups().get(0).isPlaying()) {
sign.setLine(0, IS_PLAYING);
sign.setLine(0, DMessage.SIGN_GLOBAL_IS_PLAYING.getMessage());
} else if (game.getDGroups().size() >= maxGroupsPerGame) {
sign.setLine(0, FULL);
sign.setLine(0, DMessage.SIGN_GLOBAL_FULL.getMessage());
} else {
sign.setLine(0, JOIN_GAME);
sign.setLine(0, DMessage.SIGN_GLOBAL_JOIN_GAME.getMessage());
}
int j = 1;
@ -185,7 +177,7 @@ public class GameSign extends GlobalProtection {
}
} else {
sign.setLine(0, NEW_GAME);
sign.setLine(0, DMessage.SIGN_GLOBAL_NEW_GAME.getMessage());
}
sign.update();
@ -469,13 +461,13 @@ public class GameSign extends GlobalProtection {
Sign topSign = (Sign) topBlock.getState();
if (topSign.getLine(0).equals(NEW_GAME)) {
if (topSign.getLine(0).equals(DMessage.SIGN_GLOBAL_NEW_GAME.getMessage())) {
Game game = new Game(dGroup);
dGroup.setDungeon(gameSign.dungeon);
gameSign.games[column] = game;
gameSign.update();
} else if (topSign.getLine(0).equals(JOIN_GAME)) {
} else if (topSign.getLine(0).equals(DMessage.SIGN_GLOBAL_JOIN_GAME.getMessage())) {
gameSign.games[column].addDGroup(dGroup);
gameSign.update();
}

View File

@ -27,7 +27,6 @@ import io.github.dre2n.dungeonsxl.world.DResourceWorld;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
@ -42,13 +41,6 @@ import org.bukkit.entity.Player;
*/
public class GroupSign extends GlobalProtection {
// Sign Labels
public static final String IS_PLAYING = ChatColor.DARK_RED + "Is Playing";
public static final String FULL = ChatColor.DARK_RED + "Full";
public static final String JOIN_GROUP = ChatColor.DARK_GREEN + "Join Group";
public static final String NEW_GROUP = ChatColor.DARK_GREEN + "New Group";
// Variables
private DGroup[] dGroups;
private Dungeon dungeon;
private int maxPlayersPerGroup;
@ -157,13 +149,13 @@ public class GroupSign extends GlobalProtection {
// Set Signs
if (dGroup != null) {
if (dGroup.isPlaying()) {
sign.setLine(0, IS_PLAYING);
sign.setLine(0, DMessage.SIGN_GLOBAL_IS_PLAYING.getMessage());
} else if (dGroup.getPlayers().size() >= maxPlayersPerGroup) {
sign.setLine(0, FULL);
sign.setLine(0, DMessage.SIGN_GLOBAL_FULL.getMessage());
} else {
sign.setLine(0, JOIN_GROUP);
sign.setLine(0, DMessage.SIGN_GLOBAL_JOIN_GROUP.getMessage());
}
int j = 1;
@ -184,7 +176,7 @@ public class GroupSign extends GlobalProtection {
}
} else {
sign.setLine(0, NEW_GROUP);
sign.setLine(0, DMessage.SIGN_GLOBAL_NEW_GROUP.getMessage());
}
sign.update();
@ -433,11 +425,11 @@ public class GroupSign extends GlobalProtection {
Sign topSign = (Sign) topBlock.getState();
if (topSign.getLine(0).equals(NEW_GROUP)) {
if (topSign.getLine(0).equals(DMessage.SIGN_GLOBAL_NEW_GROUP.getMessage())) {
groupSign.dGroups[column] = new DGroup(player, groupSign.dungeon);
groupSign.update();
} else if (topSign.getLine(0).equals(JOIN_GROUP)) {
} else if (topSign.getLine(0).equals(DMessage.SIGN_GLOBAL_JOIN_GROUP.getMessage())) {
groupSign.dGroups[column].addPlayer(player);
groupSign.update();
}

View File

@ -63,7 +63,7 @@ public class LeaveSign extends GlobalProtection {
/* Actions */
public void setText() {
sign.setLine(0, ChatColor.BLUE + "############");
sign.setLine(1, ChatColor.DARK_GREEN + "Leave");
sign.setLine(1, DMessage.SIGN_LEAVE.getMessage());
sign.setLine(2, "");
sign.setLine(3, ChatColor.BLUE + "############");
sign.update();

View File

@ -16,6 +16,7 @@
*/
package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.dungeonsxl.config.DMessage;
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.world.DGameWorld;
@ -54,7 +55,7 @@ public class EndSign extends DSign {
}
getSign().setLine(0, ChatColor.DARK_BLUE + "############");
getSign().setLine(1, ChatColor.DARK_GREEN + "End");
getSign().setLine(1, DMessage.SIGN_END.getMessage());
getSign().setLine(2, "");
getSign().setLine(3, ChatColor.DARK_BLUE + "############");
getSign().update();

View File

@ -16,6 +16,7 @@
*/
package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.dungeonsxl.config.DMessage;
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.world.DGameWorld;
@ -76,9 +77,9 @@ public class FloorSign extends DSign {
}
getSign().setLine(0, ChatColor.DARK_BLUE + "############");
getSign().setLine(1, ChatColor.DARK_GREEN + "ENTER");
getSign().setLine(1, DMessage.SIGN_FLOOR_1.getMessage());
if (floor == null) {
getSign().setLine(2, ChatColor.DARK_GREEN + "NEXT FLOOR");
getSign().setLine(2, DMessage.SIGN_FLOOR_2.getMessage());
} else {
getSign().setLine(2, ChatColor.DARK_GREEN + floor.getName().replaceAll("_", " "));
}

View File

@ -16,6 +16,7 @@
*/
package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.dungeonsxl.config.DMessage;
import io.github.dre2n.dungeonsxl.event.dplayer.instance.game.DGamePlayerEscapeEvent;
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
@ -55,7 +56,7 @@ public class LeaveSign extends DSign {
addTrigger(trigger);
}
getSign().setLine(0, ChatColor.DARK_BLUE + "############");
getSign().setLine(1, ChatColor.DARK_GREEN + "Leave");
getSign().setLine(1, DMessage.SIGN_LEAVE.getMessage());
getSign().setLine(2, "");
getSign().setLine(3, ChatColor.DARK_BLUE + "############");
getSign().update();

View File

@ -16,6 +16,7 @@
*/
package io.github.dre2n.dungeonsxl.sign;
import io.github.dre2n.dungeonsxl.config.DMessage;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.world.DGameWorld;
import org.bukkit.ChatColor;
@ -94,7 +95,7 @@ public class ResourcePackSign extends DSign {
String name = lines[1];
getSign().setLine(0, ChatColor.DARK_BLUE + "############");
getSign().setLine(1, ChatColor.DARK_GREEN + "Download");
getSign().setLine(1, DMessage.SIGN_RESOURCE_PACK.getMessage());
getSign().setLine(2, ChatColor.DARK_GREEN + name);
getSign().setLine(3, ChatColor.DARK_BLUE + "############");
getSign().update();

View File

@ -17,6 +17,7 @@
package io.github.dre2n.dungeonsxl.sign;
import de.erethon.commons.misc.NumberUtil;
import io.github.dre2n.dungeonsxl.config.DMessage;
import io.github.dre2n.dungeonsxl.trigger.InteractTrigger;
import io.github.dre2n.dungeonsxl.world.DGameWorld;
import org.bukkit.ChatColor;
@ -95,8 +96,8 @@ public class WaveSign extends DSign {
}
getSign().setLine(0, ChatColor.DARK_BLUE + "############");
getSign().setLine(1, ChatColor.DARK_GREEN + "START");
getSign().setLine(2, ChatColor.DARK_GREEN + "NEXT WAVE");
getSign().setLine(1, DMessage.SIGN_WAVE_1.getMessage());
getSign().setLine(2, DMessage.SIGN_WAVE_2.getMessage());
getSign().setLine(3, ChatColor.DARK_BLUE + "############");
getSign().update();
}

View File

@ -110,7 +110,7 @@ public class ReadySign extends DSign {
}
getSign().setLine(0, ChatColor.DARK_BLUE + "############");
getSign().setLine(1, ChatColor.DARK_GREEN + "Ready");
getSign().setLine(1, DMessage.SIGN_READY.getMessage());
getSign().setLine(2, ChatColor.DARK_RED + gameType.getSignName());
getSign().setLine(3, ChatColor.DARK_BLUE + "############");
getSign().update();