use of com.eintosti.buildsystem.object.settings.Settings in project BuildSystem by Trichtern.
the class PlayerQuitListener method onPlayerQuit.
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
plugin.getPlayerManager().closeNavigator(player);
Settings settings = settingsManager.getSettings(player);
if (settings.isNoClip()) {
plugin.getNoClipManager().stopNoClip(player.getUniqueId());
}
if (settings.isScoreboard()) {
settingsManager.stopScoreboard(player);
}
if (settings.isClearInventory()) {
player.getInventory().clear();
}
manageHidePlayer(player);
}
use of com.eintosti.buildsystem.object.settings.Settings in project BuildSystem by Trichtern.
the class SettingsInteractListener method manageDisabledInteractSetting.
@EventHandler
public void manageDisabledInteractSetting(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (event.getAction() != Action.RIGHT_CLICK_BLOCK || !isValid(event)) {
return;
}
Settings settings = settingsManager.getSettings(player);
if (!settings.isDisableInteract()) {
return;
}
Block block = event.getClickedBlock();
if (block == null) {
return;
}
ItemStack itemStack = event.getItem();
if (itemStack == null) {
return;
}
Material material = itemStack.getType();
XMaterial xMaterial = XMaterial.matchXMaterial(material);
if (xMaterial == configValues.getWorldEditWand()) {
return;
}
cachePlayers.add(player.getUniqueId());
event.setCancelled(true);
event.setUseItemInHand(Event.Result.DENY);
event.setUseInteractedBlock(Event.Result.DENY);
if (!XMaterial.supports(13) && XTag.isItem(xMaterial)) {
material = Material.valueOf(material.toString().replace("_ITEM", ""));
}
if (XTag.SIGNS.isTagged(xMaterial)) {
if (!XMaterial.supports(13)) {
material = Material.valueOf("WALL_SIGN");
} else {
String[] splitMaterial = material.toString().split("_");
material = Material.valueOf(splitMaterial[0] + "_WALL_SIGN");
}
}
if (!material.isBlock()) {
return;
}
Block adjacent = block.getRelative(event.getBlockFace());
adjacent.setType(material);
XBlock.setColor(adjacent, getItemColor(itemStack));
plugin.getCustomBlocks().rotate(adjacent, player, null);
}
use of com.eintosti.buildsystem.object.settings.Settings in project BuildSystem by Trichtern.
the class SettingsInteractListener method manageIronDoorSetting.
@EventHandler
public void manageIronDoorSetting(PlayerInteractEvent event) {
if (!isValid(event)) {
return;
}
Block block = event.getClickedBlock();
if (block == null) {
return;
}
boolean duelHanded = XMaterial.supports(9);
if (duelHanded && event.getHand() != EquipmentSlot.valueOf("HAND")) {
return;
}
Player player = event.getPlayer();
Settings settings = settingsManager.getSettings(player);
if (!settings.isTrapDoor()) {
return;
}
Action action = event.getAction();
XMaterial material = XMaterial.matchXMaterial(block.getType());
if (action == Action.RIGHT_CLICK_BLOCK && (material == XMaterial.IRON_DOOR || material == XMaterial.IRON_TRAPDOOR)) {
if (player.isSneaking()) {
return;
}
event.setCancelled(true);
switch(material) {
case IRON_TRAPDOOR:
plugin.getCustomBlocks().toggleIronTrapdoor(event);
break;
case IRON_DOOR:
plugin.getCustomBlocks().toggleIronDoor(event);
break;
default:
break;
}
}
}
Aggregations