use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.
the class BlockPhysicsListener method onLeavesDecay.
@EventHandler
public void onLeavesDecay(LeavesDecayEvent event) {
Block block = event.getBlock();
BuildWorld buildWorld = worldManager.getBuildWorld(block.getWorld().getName());
if (buildWorld != null && !buildWorld.isPhysics()) {
event.setCancelled(true);
}
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.
the class BlockPhysicsListener method onBlockGrow.
@EventHandler
public void onBlockGrow(BlockGrowEvent event) {
Block block = event.getBlock();
BuildWorld buildWorld = worldManager.getBuildWorld(block.getWorld().getName());
if (buildWorld != null && !buildWorld.isPhysics()) {
event.setCancelled(true);
}
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.
the class BlockPlaceListener method onCustomBlockPlace.
@EventHandler
public void onCustomBlockPlace(BlockPlaceEvent event) {
if (event.isCancelled()) {
return;
}
Player player = event.getPlayer();
String worldName = player.getWorld().getName();
BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
boolean isBuildWorld = buildWorld != null;
ItemStack itemStack = player.getItemInHand();
XMaterial xMaterial = XMaterial.matchXMaterial(itemStack);
if (xMaterial != XMaterial.PLAYER_HEAD) {
return;
}
boolean hadToDisablePhysics = false;
if (isBuildWorld && !buildWorld.isPhysics()) {
hadToDisablePhysics = true;
buildWorld.setPhysics(true);
}
plugin.getCustomBlocks().setBlock(event, plugin.getString("blocks_full_oak_barch"), plugin.getString("blocks_full_spruce_barch"), plugin.getString("blocks_full_birch_barch"), plugin.getString("blocks_full_jungle_barch"), plugin.getString("blocks_full_acacia_barch"), plugin.getString("blocks_full_dark_oak_barch"), plugin.getString("blocks_red_mushroom"), plugin.getString("blocks_brown_mushroom"), plugin.getString("blocks_full_mushroom_stem"), plugin.getString("blocks_mushroom_stem"), plugin.getString("blocks_mushroom_block"), plugin.getString("blocks_smooth_stone"), plugin.getString("blocks_double_stone_slab"), plugin.getString("blocks_smooth_sandstone"), plugin.getString("blocks_smooth_red_sandstone"), plugin.getString("blocks_powered_redstone_lamp"), plugin.getString("blocks_burning_furnace"), plugin.getString("blocks_command_block"), plugin.getString("blocks_barrier"), plugin.getString("blocks_mob_spawner"), plugin.getString("blocks_nether_portal"), plugin.getString("blocks_end_portal"), plugin.getString("blocks_dragon_egg"));
if (isBuildWorld && hadToDisablePhysics) {
buildWorld.setPhysics(false);
}
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.
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 einTosti.
the class NoAICommand method toggleAI.
private void toggleAI(Player player, World bukkitWorld) {
if (bukkitWorld == null) {
player.sendMessage(plugin.getString("noai_unknown_world"));
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(bukkitWorld.getName());
if (buildWorld == null) {
player.sendMessage(plugin.getString("noai_world_not_imported"));
return;
}
if (buildWorld.isMobAI()) {
buildWorld.setMobAI(false);
player.sendMessage(plugin.getString("noai_activated").replace("%world%", buildWorld.getName()));
} else {
buildWorld.setMobAI(true);
player.sendMessage(plugin.getString("noai_deactivated").replace("%world%", buildWorld.getName()));
}
boolean mobAI = buildWorld.isMobAI();
for (Entity entity : bukkitWorld.getEntities()) {
if (entity instanceof LivingEntity) {
ManageEntityAI.setAIEnabled(entity, mobAI);
}
}
}
Aggregations