mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-09-07 12:58:02 +02:00
Fixed code smells.
This commit is contained in:
parent
e911a5593d
commit
362d9f8362
@ -56,6 +56,8 @@ public class BlueprintPaster {
|
|||||||
CANCEL
|
CANCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String MINECRAFT = "minecraft:";
|
||||||
|
|
||||||
private Map<String, String> BLOCK_CONVERSION = ImmutableMap.of("sign", "oak_sign", "wall_sign", "oak_wall_sign");
|
private Map<String, String> BLOCK_CONVERSION = ImmutableMap.of("sign", "oak_sign", "wall_sign", "oak_wall_sign");
|
||||||
|
|
||||||
private BentoBox plugin;
|
private BentoBox plugin;
|
||||||
@ -189,9 +191,9 @@ public class BlueprintPaster {
|
|||||||
plugin.logWarning("World: " + world.getName() + " Failed block data: " + bpBlock.getBlockData());
|
plugin.logWarning("World: " + world.getName() + " Failed block data: " + bpBlock.getBlockData());
|
||||||
// Try to fix
|
// Try to fix
|
||||||
for (Entry<String, String> en : BLOCK_CONVERSION.entrySet()) {
|
for (Entry<String, String> en : BLOCK_CONVERSION.entrySet()) {
|
||||||
if (bpBlock.getBlockData().startsWith("minecraft:" + en.getKey())) {
|
if (bpBlock.getBlockData().startsWith(MINECRAFT + en.getKey())) {
|
||||||
bd = Bukkit.createBlockData(
|
bd = Bukkit.createBlockData(
|
||||||
bpBlock.getBlockData().replace("minecraft:" + en.getKey(), "minecraft:" + en.getValue()));
|
bpBlock.getBlockData().replace(MINECRAFT + en.getKey(), MINECRAFT + en.getValue()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ import world.bentobox.bentobox.database.objects.Players;
|
|||||||
*/
|
*/
|
||||||
public class BentoBoxMigrateCommand extends ConfirmableCommand {
|
public class BentoBoxMigrateCommand extends ConfirmableCommand {
|
||||||
|
|
||||||
|
private static final String MIGRATED = "commands.bentobox.migrate.migrated";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reloads settings, addons and localization command
|
* Reloads settings, addons and localization command
|
||||||
* @param parent command parent
|
* @param parent command parent
|
||||||
@ -38,16 +40,16 @@ public class BentoBoxMigrateCommand extends ConfirmableCommand {
|
|||||||
// Migrate BentoBox data
|
// Migrate BentoBox data
|
||||||
user.sendMessage("commands.bentobox.migrate.players");
|
user.sendMessage("commands.bentobox.migrate.players");
|
||||||
new Database<>(getPlugin(), Players.class).loadObjects();
|
new Database<>(getPlugin(), Players.class).loadObjects();
|
||||||
user.sendMessage("commands.bentobox.migrate.migrated");
|
user.sendMessage(MIGRATED);
|
||||||
user.sendMessage("commands.bentobox.migrate.names");
|
user.sendMessage("commands.bentobox.migrate.names");
|
||||||
new Database<>(getPlugin(), Names.class).loadObjects();
|
new Database<>(getPlugin(), Names.class).loadObjects();
|
||||||
user.sendMessage("commands.bentobox.migrate.migrated");
|
user.sendMessage(MIGRATED);
|
||||||
// Migrate addons data
|
// Migrate addons data
|
||||||
user.sendMessage("commands.bentobox.migrate.addons");
|
user.sendMessage("commands.bentobox.migrate.addons");
|
||||||
getPlugin().getAddonsManager().getDataObjects().forEach(t -> {
|
getPlugin().getAddonsManager().getDataObjects().forEach(t -> {
|
||||||
user.sendMessage("commands.bentobox.migrate.class", TextVariables.DESCRIPTION, t.getCanonicalName());
|
user.sendMessage("commands.bentobox.migrate.class", TextVariables.DESCRIPTION, t.getCanonicalName());
|
||||||
new Database<>(getPlugin(), t).loadObjects();
|
new Database<>(getPlugin(), t).loadObjects();
|
||||||
user.sendMessage("commands.bentobox.migrate.migrated");
|
user.sendMessage(MIGRATED);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -71,7 +71,7 @@ public class SchemToBlueprint {
|
|||||||
// Make a new blueprint bundle
|
// Make a new blueprint bundle
|
||||||
BlueprintBundle bb = new BlueprintBundle();
|
BlueprintBundle bb = new BlueprintBundle();
|
||||||
// TODO: This is just placeholder text
|
// TODO: This is just placeholder text
|
||||||
if (name.equalsIgnoreCase("island")) {
|
if (name.equalsIgnoreCase(DEFAULT_SCHEM_NAME)) {
|
||||||
bb.setUniqueId(BlueprintsManager.DEFAULT_BUNDLE_NAME);
|
bb.setUniqueId(BlueprintsManager.DEFAULT_BUNDLE_NAME);
|
||||||
bb.setDisplayName(ChatColor.YELLOW + "The Original");
|
bb.setDisplayName(ChatColor.YELLOW + "The Original");
|
||||||
bb.setDescription(ChatColor.AQUA + "Standard set of islands");
|
bb.setDescription(ChatColor.AQUA + "Standard set of islands");
|
||||||
@ -109,9 +109,9 @@ public class SchemToBlueprint {
|
|||||||
try {
|
try {
|
||||||
SchemLoader loader = new SchemLoader(plugin, schems);
|
SchemLoader loader = new SchemLoader(plugin, schems);
|
||||||
loader.load(name);
|
loader.load(name);
|
||||||
plugin.log("Loaded " + name + ".schem");
|
plugin.log("Loaded " + name + FILE_EXTENSION);
|
||||||
// Convert blueprint
|
// Convert blueprint
|
||||||
plugin.log("Converting " + name + ".schem to a blueprint");
|
plugin.log("Converting " + name + FILE_EXTENSION + " to a blueprint");
|
||||||
Blueprint bp = new Converter().convert(loader.getBlockConfig());
|
Blueprint bp = new Converter().convert(loader.getBlockConfig());
|
||||||
bp.setName(name);
|
bp.setName(name);
|
||||||
plugin.log("Saving blueprint");
|
plugin.log("Saving blueprint");
|
||||||
|
Loading…
Reference in New Issue
Block a user