use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by Trichtern.
the class BuildWorldResetUnloadListener method onPlayerQuit.
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
World from = event.getPlayer().getWorld();
BuildWorld buildWorld = worldManager.getBuildWorld(from.getName());
if (buildWorld != null) {
buildWorld.resetUnloadTask();
}
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by Trichtern.
the class EditSessionListener method onEditSession.
@Subscribe
public void onEditSession(EditSessionEvent event) {
Actor actor = event.getActor();
if (actor == null || !actor.isPlayer()) {
return;
}
Player player = Bukkit.getPlayer(actor.getName());
if (player == null) {
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(player.getWorld().getName());
if (buildWorld == null) {
return;
}
if (event.getStage() == EditSession.Stage.BEFORE_CHANGE) {
disableArchivedWorlds(buildWorld, player, event);
checkBuilders(buildWorld, player, event);
}
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by Trichtern.
the class PlayerChangedWorldListener method onPlayerChangedWorld.
@EventHandler
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
String worldName = player.getWorld().getName();
BuildWorld oldWorld = worldManager.getBuildWorld(event.getFrom().getName());
if (oldWorld != null && configValues.isUnloadWorlds()) {
oldWorld.resetUnloadTask();
}
BuildWorld newWorld = worldManager.getBuildWorld(worldName);
if (newWorld != null) {
if (!newWorld.isPhysics()) {
if (player.hasPermission("buildsystem.physics.message")) {
player.sendMessage(plugin.getString("physics_deactivated_in_world").replace("%world%", newWorld.getName()));
}
}
}
removeOldNavigator(player);
removeBuildMode(player);
setGoldBlock(newWorld);
checkWorldStatus(player);
if (settingsManager.getSettings(player).isScoreboard()) {
playerManager.forceUpdateSidebar(player);
}
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by Trichtern.
the class ExplosionsCommand method toggleExplosions.
private void toggleExplosions(Player player, World bukkitWorld) {
if (bukkitWorld == null) {
player.sendMessage(plugin.getString("explosions_unknown_world"));
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(bukkitWorld.getName());
if (buildWorld == null) {
player.sendMessage(plugin.getString("explosions_world_not_imported"));
return;
}
if (!buildWorld.isExplosions()) {
buildWorld.setExplosions(true);
player.sendMessage(plugin.getString("explosions_activated").replace("%world%", buildWorld.getName()));
} else {
buildWorld.setExplosions(false);
player.sendMessage(plugin.getString("explosions_deactivated").replace("%world%", buildWorld.getName()));
}
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by Trichtern.
the class RoleCalculator method calculate.
@Override
public void calculate(@NonNull Player player, @NonNull ContextConsumer contextConsumer) {
BuildWorld buildWorld = worldManager.getBuildWorld(player.getWorld());
contextConsumer.accept(KEY, Role.matchRole(player, buildWorld).toString());
}
Aggregations