externalize strings
plotme conversion fixes
This commit is contained in:
Jesse Boyd
2016-09-26 18:31:08 +10:00
parent c99e23bd3c
commit 12f8861d07
66 changed files with 655 additions and 445 deletions

View File

@ -70,6 +70,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
public static WorldEdit worldEdit;
private int[] version;
private String name;
@Override
public int[] getServerVersion() {
@ -92,15 +93,16 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
@Override
public void onEnable() {
try {
this.name = getDescription().getName();
getServer().getName();
new PS(this, "Nukkit");
if (Settings.Enabled_Components.METRICS) {
new Metrics(this).start();
PS.log(C.PREFIX + "&6Metrics enabled.");
} else {
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS);
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
}
Generator.addGenerator(NukkitHybridGen.class, "PlotSquared", 1);
Generator.addGenerator(NukkitHybridGen.class, getPluginName(), 1);
} catch (Throwable e) {
e.printStackTrace();
}
@ -144,6 +146,11 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
return getDescription().getVersion();
}
@Override
public String getPluginName() {
return name;
}
@Override
public void registerCommands() {
NukkitCommand bukkitCommand = new NukkitCommand("plot", new String[] {"p","plot","ps","plotsquared","p2","2"});

View File

@ -4,6 +4,7 @@ import cn.nukkit.Player;
import cn.nukkit.event.player.PlayerTeleportEvent;
import cn.nukkit.plugin.RegisteredListener;
import cn.nukkit.utils.EventException;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EconHandler;
@ -62,7 +63,7 @@ public class NukkitPlayer extends PlotPlayer {
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to, PlayerTeleportEvent.TeleportCause.PLUGIN);
RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
for (RegisteredListener listener : listeners) {
if (listener.getPlugin().getName().equals("PlotSquared")) {
if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
continue;
}
try {
@ -76,7 +77,7 @@ public class NukkitPlayer extends PlotPlayer {
}
event = new PlayerTeleportEvent(player, to, from, PlayerTeleportEvent.TeleportCause.PLUGIN);
for (RegisteredListener listener : listeners) {
if (listener.getPlugin().getName().equals("PlotSquared")) {
if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
continue;
}
try {

View File

@ -11,7 +11,7 @@ import com.intellectualcrafters.plot.object.ConsolePlayer;
public class NukkitCommand extends Command {
public NukkitCommand(String cmd, String[] aliases) {
super(cmd, "PlotSquared command", "/plot", aliases);
super(cmd, "Plot command", "/plot", aliases);
}

View File

@ -7,7 +7,6 @@ import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.SetupUtils;
@ -38,7 +37,7 @@ public class NukkitSetupUtils extends SetupUtils {
map.put("world", testWorld);
map.put("plot-generator", PS.get().IMP.getDefaultGenerator());
NukkitPlotGenerator gen = new NukkitPlotGenerator(map);
SetupUtils.generators.put("PlotSquared", gen);
SetupUtils.generators.put(PS.imp().getPluginName(), gen);
}
@Override
@ -160,7 +159,7 @@ public class NukkitSetupUtils extends SetupUtils {
return entry.getKey();
}
}
return "PlotSquared";
return PS.imp().getPluginName();
} catch (Throwable e) {
e.printStackTrace();
}