use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.
the class SpawnCommand method onCommand.
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
plugin.getLogger().warning(plugin.getString("sender_not_player"));
return true;
}
Player player = (Player) sender;
switch(args.length) {
case 0:
if (!spawnManager.teleport(player)) {
player.sendMessage(plugin.getString("spawn_unavailable"));
} else if (plugin.getConfigValues().isSpawnTeleportMessage()) {
player.sendMessage(plugin.getString("spawn_teleported"));
}
break;
case 1:
if (!player.hasPermission("buildsystem.spawn")) {
player.sendMessage(plugin.getString("spawn_usage"));
return true;
}
switch(args[0].toLowerCase()) {
case "set":
Location playerLocation = player.getLocation();
World bukkitWorld = playerLocation.getWorld();
BuildWorld buildWorld = worldManager.getBuildWorld(bukkitWorld.getName());
if (buildWorld == null) {
player.sendMessage(plugin.getString("spawn_world_not_imported"));
return true;
}
spawnManager.set(playerLocation, buildWorld.getName());
player.sendMessage(plugin.getString("spawn_set").replace("%x%", round(playerLocation.getX())).replace("%y%", round(playerLocation.getY())).replace("%z%", round(playerLocation.getZ())).replace("%world%", playerLocation.getWorld().getName()));
break;
case "remove":
spawnManager.remove();
player.sendMessage(plugin.getString("spawn_remove"));
break;
default:
player.sendMessage(plugin.getString("spawn_admin"));
break;
}
break;
default:
if (player.hasPermission("buildsystem.spawn")) {
player.sendMessage(plugin.getString("spawn_admin"));
} else {
player.sendMessage(plugin.getString("spawn_usage"));
}
break;
}
return true;
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.
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.object.world.BuildWorld in project BuildSystem by einTosti.
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.object.world.BuildWorld in project BuildSystem by einTosti.
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.object.world.BuildWorld in project BuildSystem by Trichtern.
the class SettingsManager method injectPlaceholders.
private String injectPlaceholders(String originalString, Player player) {
if (!originalString.matches(".*%*%.*")) {
return originalString;
}
String worldName = player.getWorld().getName();
BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
return originalString.replace("%world%", worldName).replace("%status%", parseWorldInformation(buildWorld, "%status%")).replace("%permission%", parseWorldInformation(buildWorld, "%permission%")).replace("%project%", parseWorldInformation(buildWorld, "%project%")).replace("%creator%", parseWorldInformation(buildWorld, "%creator%")).replace("%creation%", parseWorldInformation(buildWorld, "%creation%"));
}
Aggregations