use of com.eintosti.buildsystem.util.external.PlayerChatInput in project BuildSystem by Trichtern.
the class WorldsCommand method getProjectInput.
public void getProjectInput(Player player, boolean closeInventory) {
BuildWorld buildWorld = playerManager.getSelectedWorld().get(player.getUniqueId());
if (buildWorld == null) {
player.closeInventory();
player.sendMessage(plugin.getString("worlds_setproject_error"));
return;
}
new PlayerChatInput(plugin, player, "enter_world_project", input -> {
buildWorld.setProject(input.trim());
playerManager.forceUpdateSidebar(buildWorld);
XSound.ENTITY_PLAYER_LEVELUP.play(player);
player.sendMessage(plugin.getString("worlds_setproject_set").replace("%world%", buildWorld.getName()));
if (closeInventory) {
player.closeInventory();
} else {
player.openInventory(plugin.getEditInventory().getInventory(player, buildWorld));
}
});
}
use of com.eintosti.buildsystem.util.external.PlayerChatInput in project BuildSystem by Trichtern.
the class WorldsCommand method getRenameInput.
private void getRenameInput(Player player) {
BuildWorld buildWorld = playerManager.getSelectedWorld().get(player.getUniqueId());
if (buildWorld == null) {
player.closeInventory();
player.sendMessage(plugin.getString("worlds_rename_unknown_world"));
return;
}
new PlayerChatInput(plugin, player, "enter_world_name", input -> {
player.closeInventory();
worldManager.renameWorld(player, buildWorld, input.trim());
playerManager.getSelectedWorld().remove(player.getUniqueId());
XSound.ENTITY_PLAYER_LEVELUP.play(player);
player.closeInventory();
});
}
use of com.eintosti.buildsystem.util.external.PlayerChatInput in project BuildSystem by Trichtern.
the class WorldsCommand method getCreatorInput.
private void getCreatorInput(Player player) {
BuildWorld buildWorld = playerManager.getSelectedWorld().get(player.getUniqueId());
if (buildWorld == null) {
player.closeInventory();
player.sendMessage(plugin.getString("worlds_setcreator_error"));
return;
}
new PlayerChatInput(plugin, player, "enter_world_creator", input -> {
String creator = input.trim();
buildWorld.setCreator(creator);
if (!creator.equalsIgnoreCase("-")) {
buildWorld.setCreatorId(UUIDFetcher.getUUID(creator));
} else {
buildWorld.setCreatorId(null);
}
playerManager.forceUpdateSidebar(buildWorld);
XSound.ENTITY_PLAYER_LEVELUP.play(player);
player.sendMessage(plugin.getString("worlds_setcreator_set").replace("%world%", buildWorld.getName()));
player.closeInventory();
});
}
use of com.eintosti.buildsystem.util.external.PlayerChatInput in project BuildSystem by Trichtern.
the class WorldManager method createCustomWorld.
/**
* Generate a {@link BuildWorld} with a custom generator.
*
* @param player The player who is creating the world
* @param worldName The name of the world
* @param privateWorld Is world going to be a private world?
* @return {@code true} if the world was successfully created, {@code false otherwise}
* @author Ein_Jojo
*/
public boolean createCustomWorld(Player player, String worldName, boolean privateWorld) {
if (worldExists(player, worldName)) {
return false;
}
new PlayerChatInput(plugin, player, "enter_generator_name", input -> {
List<String> genArray;
if (input.contains(":")) {
genArray = Arrays.asList(input.split(":"));
} else {
genArray = Arrays.asList(input, input);
}
ChunkGenerator chunkGenerator = getChunkGenerator(genArray.get(0), genArray.get(1), worldName);
if (chunkGenerator == null) {
player.sendMessage(plugin.getString("worlds_import_unknown_generator"));
XSound.ENTITY_ITEM_BREAK.play(player);
return;
} else {
plugin.getLogger().info("Using custom world generator: " + input);
}
BuildWorld buildWorld = new BuildWorld(plugin, worldName, player.getName(), player.getUniqueId(), WorldType.CUSTOM, System.currentTimeMillis(), privateWorld, input);
buildWorlds.add(buildWorld);
player.sendMessage(plugin.getString("worlds_world_creation_started").replace("%world%", buildWorld.getName()).replace("%type%", buildWorld.getType().getName()));
generateBukkitWorld(worldName, buildWorld.getType(), buildWorld.getDifficulty(), chunkGenerator);
player.sendMessage(plugin.getString("worlds_creation_finished"));
});
return true;
}
Aggregations