mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-03-02 10:31:23 +01:00
Final touches
This commit is contained in:
parent
278d4f84d2
commit
3a5c29fe28
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>skyblock</artifactId>
|
||||
<version>2.2.12</version>
|
||||
<version>2.2.13</version>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
|
@ -64,7 +64,7 @@ public class GuiPermissions extends Gui {
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Visitor.Item.Welcome.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu.Settings.Visitor.Item.Welcome.Lore"))),
|
||||
(event) -> {
|
||||
guiManager.showGUI(event.player, new WelcomeEditor(plugin, this, island));
|
||||
guiManager.showGUI(event.player, new GuiWelcomeEditor(plugin, this, island));
|
||||
});
|
||||
|
||||
if (config.getFileConfiguration().getBoolean("Island.Visitor.Signature.Enable")) {
|
||||
@ -72,7 +72,7 @@ public class GuiPermissions extends Gui {
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Visitor.Item.Signature.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu.Settings.Visitor.Item.Signature.Lore"))),
|
||||
(event) -> {
|
||||
guiManager.showGUI(event.player, new SignatureEditor(plugin, this, island));
|
||||
guiManager.showGUI(event.player, new GuiSignatureEditor(plugin, this, island));
|
||||
});
|
||||
}
|
||||
|
||||
@ -118,14 +118,16 @@ public class GuiPermissions extends Gui {
|
||||
this.pages = (int) Math.max(1, Math.ceil(itemCount / 36));
|
||||
|
||||
if (page != 1)
|
||||
setButton(5, 2, GuiUtils.createButtonItem(CompatibleMaterial.ARROW, "Back"),
|
||||
setButton(5, 2, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Last.Displayname"))),
|
||||
(event) -> {
|
||||
page--;
|
||||
paint();
|
||||
});
|
||||
|
||||
if (page != pages)
|
||||
setButton(5, 6, GuiUtils.createButtonItem(CompatibleMaterial.ARROW, "Next"),
|
||||
setButton(5, 6, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Next.Displayname"))),
|
||||
(event) -> {
|
||||
page++;
|
||||
paint();
|
||||
|
@ -9,22 +9,28 @@ import com.songoda.core.utils.TextUtils;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandMessage;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SignatureEditor extends Gui {
|
||||
public class GuiSignatureEditor extends Gui {
|
||||
|
||||
private final SkyBlock plugin;
|
||||
private final FileConfiguration configLoad;
|
||||
private final Gui returnGui;
|
||||
private final Island island;
|
||||
private final FileManager.Config mainConfig;
|
||||
private final MessageManager messageManager;
|
||||
private final IslandManager islandManager;
|
||||
|
||||
public SignatureEditor(SkyBlock plugin, Gui returnGui, Island island) {
|
||||
public GuiSignatureEditor(SkyBlock plugin, Gui returnGui, Island island) {
|
||||
super(1);
|
||||
this.plugin = plugin;
|
||||
this.returnGui = returnGui;
|
||||
@ -32,6 +38,8 @@ public class SignatureEditor extends Gui {
|
||||
this.configLoad = plugin.getFileManager()
|
||||
.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
this.mainConfig = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||
this.messageManager = plugin.getMessageManager();
|
||||
this.islandManager = plugin.getIslandManager();
|
||||
setDefaultItem(null);
|
||||
setTitle(TextUtils.formatText(configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Title")));
|
||||
paint();
|
||||
@ -55,9 +63,19 @@ public class SignatureEditor extends Gui {
|
||||
(event -> {
|
||||
AnvilGui gui = new AnvilGui(event.player, this);
|
||||
gui.setAction((e -> {
|
||||
signatureMessage.add(gui.getInputText().trim());
|
||||
island.setMessage(IslandMessage.Signature, e.player.getName(), signatureMessage);
|
||||
CompatibleSound.BLOCK_NOTE_BLOCK_PLING.play(e.player);
|
||||
if (!hasPermission(e.player))
|
||||
return;
|
||||
if (island.getMessage(IslandMessage.Signature)
|
||||
.size() > mainConfig.getFileConfiguration().getInt(
|
||||
"Island.Visitor.Signature.Lines")
|
||||
|| gui.getInputText().length() > mainConfig.getFileConfiguration()
|
||||
.getInt("Island.Visitor.Signature.Length")) {
|
||||
CompatibleSound.BLOCK_ANVIL_LAND.play(e.player);
|
||||
} else {
|
||||
signatureMessage.add(gui.getInputText().trim());
|
||||
island.setMessage(IslandMessage.Signature, e.player.getName(), signatureMessage);
|
||||
CompatibleSound.BLOCK_NOTE_BLOCK_PLING.play(e.player);
|
||||
}
|
||||
e.player.closeInventory();
|
||||
paint();
|
||||
}));
|
||||
@ -83,4 +101,37 @@ public class SignatureEditor extends Gui {
|
||||
paint();
|
||||
}));
|
||||
}
|
||||
|
||||
private boolean hasPermission(Player player) {
|
||||
Island island1 = islandManager.getIsland(player);
|
||||
|
||||
if (island1 == null) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString(
|
||||
"Command.Island.Settings.Owner.Message"));
|
||||
CompatibleSound.BLOCK_ANVIL_LAND.play(player);
|
||||
player.closeInventory();
|
||||
return false;
|
||||
} else if (!(island1.hasRole(IslandRole.Operator,
|
||||
player.getUniqueId())
|
||||
|| island1.hasRole(IslandRole.Owner,
|
||||
player.getUniqueId()))) {
|
||||
messageManager.sendMessage(player, configLoad
|
||||
.getString("Command.Island.Role.Message"));
|
||||
CompatibleSound.BLOCK_ANVIL_LAND.play(player);
|
||||
player.closeInventory();
|
||||
return false;
|
||||
} else if (!plugin.getFileManager()
|
||||
.getConfig(new File(plugin.getDataFolder(),
|
||||
"config.yml"))
|
||||
.getFileConfiguration().getBoolean(
|
||||
"Island.Visitor.Signature.Enable")) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString(
|
||||
"Island.Settings.Visitor.Signature.Disabled.Message"));
|
||||
CompatibleSound.BLOCK_ANVIL_LAND.play(player);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WelcomeEditor extends Gui {
|
||||
public class GuiWelcomeEditor extends Gui {
|
||||
|
||||
private final SkyBlock plugin;
|
||||
private final FileConfiguration configLoad;
|
||||
@ -30,7 +30,7 @@ public class WelcomeEditor extends Gui {
|
||||
private final MessageManager messageManager;
|
||||
private final IslandManager islandManager;
|
||||
|
||||
public WelcomeEditor(SkyBlock plugin, Gui returnGui, Island island) {
|
||||
public GuiWelcomeEditor(SkyBlock plugin, Gui returnGui, Island island) {
|
||||
super(1);
|
||||
this.plugin = plugin;
|
||||
this.returnGui = returnGui;
|
||||
@ -65,11 +65,11 @@ public class WelcomeEditor extends Gui {
|
||||
gui.setAction((e -> {
|
||||
if (!hasPermission(e.player))
|
||||
return;
|
||||
if (island.getMessage(IslandMessage.Signature)
|
||||
if (island.getMessage(IslandMessage.Welcome)
|
||||
.size() > mainConfig.getFileConfiguration().getInt(
|
||||
"Island.Visitor.Signature.Lines")
|
||||
"Island.Visitor.Welcome.Lines")
|
||||
|| gui.getInputText().length() > mainConfig.getFileConfiguration()
|
||||
.getInt("Island.Visitor.Signature.Length")) {
|
||||
.getInt("Island.Visitor.Welcome.Length")) {
|
||||
CompatibleSound.BLOCK_ANVIL_LAND.play(e.player);
|
||||
} else {
|
||||
welcomeMessage.add(gui.getInputText().trim());
|
||||
@ -125,10 +125,10 @@ public class WelcomeEditor extends Gui {
|
||||
.getConfig(new File(plugin.getDataFolder(),
|
||||
"config.yml"))
|
||||
.getFileConfiguration().getBoolean(
|
||||
"Island.Visitor.Signature.Enable")) {
|
||||
"Island.Visitor.Welcome.Enable")) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString(
|
||||
"Island.Settings.Visitor.Signature.Disabled.Message"));
|
||||
"Island.Settings.Visitor.Welcome.Disabled.Message"));
|
||||
CompatibleSound.BLOCK_ANVIL_LAND.play(player);
|
||||
return false;
|
||||
}
|
@ -33,6 +33,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
import org.bukkit.event.world.PortalCreateEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -204,8 +205,7 @@ public class Block implements Listener {
|
||||
}
|
||||
|
||||
// Check permissions.
|
||||
if (!skyblock.getPermissionManager().processPermission(new PlayerEnterPortalEvent(player, player.getLocation()),
|
||||
player, island))
|
||||
if (!skyblock.getPermissionManager().processPermission(event, player, island))
|
||||
return;
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
@ -621,6 +621,20 @@ public class Block implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player == null) return;
|
||||
|
||||
if (skyblock.getWorldManager().isIslandWorld(player.getWorld())) {
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
Island island = islandManager.getIslandAtLocation(event.getBlock().getLocation());
|
||||
// Check permissions.
|
||||
skyblock.getPermissionManager().processPermission(event, player, island);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDispenserDispenseBlock(BlockDispenseEvent event) {
|
||||
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection"))
|
||||
|
@ -361,45 +361,41 @@ public class Entity implements Listener {
|
||||
|
||||
if (skyblock.getWorldManager().isIslandWorld(entity.getWorld())) {
|
||||
// Check permissions.
|
||||
if (!skyblock.getPermissionManager().hasPermission(null,
|
||||
islandManager.getIslandAtLocation(entity.getLocation()), "Explosions"))
|
||||
event.setCancelled(true);
|
||||
Island island = islandManager.getIslandAtLocation(entity.getLocation());
|
||||
skyblock.getPermissionManager().processPermission(event, null, island);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
Island island = islandManager.getIslandAtLocation(entity.getLocation());
|
||||
|
||||
if (island != null) {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Block.Level.Enable")) {
|
||||
for (org.bukkit.block.Block blockList : event.blockList()) {
|
||||
@SuppressWarnings("deprecation")
|
||||
CompatibleMaterial materials = CompatibleMaterial.getBlockMaterial(blockList.getType());
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Block.Level.Enable")) {
|
||||
for (org.bukkit.block.Block blockList : event.blockList()) {
|
||||
@SuppressWarnings("deprecation")
|
||||
CompatibleMaterial materials = CompatibleMaterial.getBlockMaterial(blockList.getType());
|
||||
|
||||
if (materials != null) {
|
||||
IslandLevel level = island.getLevel();
|
||||
if (materials != null) {
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
if (level.hasMaterial(materials.name())) {
|
||||
long materialAmount = level.getMaterialAmount(materials.name());
|
||||
if (level.hasMaterial(materials.name())) {
|
||||
long materialAmount = level.getMaterialAmount(materials.name());
|
||||
|
||||
if (materialAmount - 1 <= 0) {
|
||||
level.removeMaterial(materials.name());
|
||||
} else {
|
||||
level.setMaterialAmount(materials.name(), materialAmount - 1);
|
||||
}
|
||||
if (materialAmount - 1 <= 0) {
|
||||
level.removeMaterial(materials.name());
|
||||
} else {
|
||||
level.setMaterialAmount(materials.name(), materialAmount - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SkyBlock.getInstance().getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Spawn.Protection")) {
|
||||
IslandWorld world = worldManager.getIslandWorld(event.getEntity().getWorld());
|
||||
for (org.bukkit.block.Block block : event.blockList()) {
|
||||
if (LocationUtil.isLocationLocation(block.getLocation(),
|
||||
island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))) {
|
||||
event.blockList().remove(block);
|
||||
break;
|
||||
}
|
||||
if (SkyBlock.getInstance().getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Spawn.Protection")) {
|
||||
IslandWorld world = worldManager.getIslandWorld(event.getEntity().getWorld());
|
||||
for (org.bukkit.block.Block block : event.blockList()) {
|
||||
if (LocationUtil.isLocationLocation(block.getLocation(),
|
||||
island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))) {
|
||||
event.blockList().remove(block);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,8 +61,7 @@ public class Teleport implements Listener {
|
||||
com.songoda.skyblock.island.Island island = islandManager.getIslandAtLocation(event.getTo());
|
||||
|
||||
// Check permissions.
|
||||
if (!skyblock.getPermissionManager().processPermission(new PlayerEnterPortalEvent(player, player.getLocation()),
|
||||
player, island))
|
||||
if (!skyblock.getPermissionManager().processPermission(event, player, island))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import com.songoda.skyblock.permission.event.events.ProjectileLaunchByPlayerEven
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
@ -77,6 +78,8 @@ public abstract class ListeningPermission extends BasicPermission {
|
||||
|
||||
public void onProjectileLaunch(ProjectileLaunchByPlayerEvent event) {}
|
||||
|
||||
public void onBlockIgnite(BlockIgniteEvent event) {}
|
||||
|
||||
protected void noPermsMessage(Player player, SkyBlock plugin, MessageManager messageManager) {
|
||||
messageManager.sendMessage(player,
|
||||
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
|
||||
|
@ -73,7 +73,7 @@ public class PermissionManager {
|
||||
new PvpPermission(plugin),
|
||||
new HangingDestroyPermission(plugin),
|
||||
new DamagePermission(plugin),
|
||||
new ExplosionsPermission(),
|
||||
new ExplosionsPermission(plugin),
|
||||
new MobTamingPermission(plugin),
|
||||
new MobGriefingPermission(plugin),
|
||||
new ExperienceOrbPickupPermission(plugin),
|
||||
|
@ -41,6 +41,7 @@ public class BrewingPermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getDamager() instanceof Player)) return;
|
||||
Player player = (Player)event.getDamager();
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
|
@ -42,6 +42,7 @@ public class DestroyPermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getDamager() instanceof Player)) return;
|
||||
Player player = (Player)event.getDamager();
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
|
@ -7,6 +7,8 @@ import com.songoda.skyblock.permission.ListeningPermission;
|
||||
import com.songoda.skyblock.permission.PermissionHandler;
|
||||
import com.songoda.skyblock.permission.PermissionType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class EntityPlacementPermission extends ListeningPermission {
|
||||
@ -22,8 +24,6 @@ public class EntityPlacementPermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
|
||||
|
||||
Player player = event.getPlayer();
|
||||
if (event.getItem() != null && CompatibleMaterial.getMaterial(event.getItem()) != CompatibleMaterial.AIR) {
|
||||
if (CompatibleMaterial.getMaterial(event.getItem()) == CompatibleMaterial.ARMOR_STAND
|
||||
|
@ -1,19 +1,25 @@
|
||||
package com.songoda.skyblock.permission.permissions.listening;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.permission.ListeningPermission;
|
||||
import com.songoda.skyblock.permission.PermissionHandler;
|
||||
import com.songoda.skyblock.permission.PermissionType;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class ExplosionsPermission extends ListeningPermission {
|
||||
|
||||
public ExplosionsPermission() {
|
||||
private SkyBlock plugin;
|
||||
|
||||
public ExplosionsPermission(SkyBlock plugin) {
|
||||
super("Explosions", CompatibleMaterial.GUNPOWDER, PermissionType.GENERIC);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@PermissionHandler
|
||||
@ -34,4 +40,14 @@ public class ExplosionsPermission extends ListeningPermission {
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@PermissionHandler
|
||||
public void onBlockInteract(PlayerInteractEvent event) {
|
||||
if (CompatibleMaterial.getMaterial(event.getPlayer().getItemInHand()) != CompatibleMaterial.FLINT_AND_STEEL)
|
||||
return;
|
||||
|
||||
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock());
|
||||
if (material == CompatibleMaterial.TNT)
|
||||
cancelAndMessage(event, event.getPlayer(), plugin, plugin.getMessageManager());
|
||||
}
|
||||
}
|
||||
|
@ -24,13 +24,10 @@ public class FirePermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
|
||||
|
||||
if (event.getAction() != Action.LEFT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getClickedBlock();
|
||||
|
||||
if (CompatibleMaterial.getMaterial(player.getTargetBlock(null, 5)) == CompatibleMaterial.FIRE)
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.songoda.skyblock.permission.permissions.listening;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.permission.ListeningPermission;
|
||||
import com.songoda.skyblock.permission.PermissionHandler;
|
||||
import com.songoda.skyblock.permission.PermissionType;
|
||||
import com.songoda.skyblock.permission.event.events.PlayerEnterPortalEvent;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import com.songoda.skyblock.utils.world.LocationUtil;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
@ -43,19 +43,11 @@ public class PortalPermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onTeleport(PlayerTeleportEvent event) {
|
||||
boolean isCause = false;
|
||||
|
||||
if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL || event.getCause() == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL || event.getCause() == PlayerTeleportEvent.TeleportCause.END_PORTAL) {
|
||||
isCause = true;
|
||||
} else {
|
||||
if (NMSUtil.getVersionNumber() > 9) {
|
||||
if (event.getCause() == PlayerTeleportEvent.TeleportCause.END_GATEWAY) {
|
||||
isCause = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isCause)
|
||||
if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL
|
||||
|| event.getCause() == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL
|
||||
|| event.getCause() == PlayerTeleportEvent.TeleportCause.END_PORTAL
|
||||
|| ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) &&
|
||||
event.getCause() == PlayerTeleportEvent.TeleportCause.END_GATEWAY)
|
||||
cancelAndMessage(event, event.getPlayer(), plugin, messageManager);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.songoda.skyblock.permission.ListeningPermission;
|
||||
import com.songoda.skyblock.permission.PermissionHandler;
|
||||
import com.songoda.skyblock.permission.PermissionPriority;
|
||||
import com.songoda.skyblock.permission.PermissionType;
|
||||
import com.songoda.skyblock.permission.event.events.ProjectileLaunchByPlayerEvent;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
@ -34,7 +35,7 @@ public class ProjectilePermission extends ListeningPermission {
|
||||
}
|
||||
|
||||
@PermissionHandler(priority = PermissionPriority.LAST)
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
public void onProjectileLaunch(ProjectileLaunchByPlayerEvent event) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.songoda.skyblock.permission.permissions.listening;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.permission.ListeningPermission;
|
||||
import com.songoda.skyblock.permission.PermissionHandler;
|
||||
import com.songoda.skyblock.permission.PermissionType;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.minecart.StorageMinecart;
|
||||
@ -27,16 +27,14 @@ public class StoragePermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK)
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock());
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (material == CompatibleMaterial.CHEST || material == CompatibleMaterial.TRAPPED_CHEST
|
||||
|| (NMSUtil.getVersionNumber() > 9 && (material == CompatibleMaterial.SHULKER_BOX
|
||||
|| (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) && (material == CompatibleMaterial.SHULKER_BOX
|
||||
|| material == CompatibleMaterial.BLACK_SHULKER_BOX || material == CompatibleMaterial.BLUE_SHULKER_BOX
|
||||
|| material == CompatibleMaterial.BROWN_SHULKER_BOX || material == CompatibleMaterial.CYAN_SHULKER_BOX
|
||||
|| material == CompatibleMaterial.GRAY_SHULKER_BOX || material == CompatibleMaterial.GREEN_SHULKER_BOX
|
||||
@ -44,14 +42,13 @@ public class StoragePermission extends ListeningPermission {
|
||||
|| material == CompatibleMaterial.LIME_SHULKER_BOX || material == CompatibleMaterial.MAGENTA_SHULKER_BOX
|
||||
|| material == CompatibleMaterial.ORANGE_SHULKER_BOX || material == CompatibleMaterial.PINK_SHULKER_BOX
|
||||
|| material == CompatibleMaterial.PURPLE_SHULKER_BOX || material == CompatibleMaterial.RED_SHULKER_BOX
|
||||
|| material == CompatibleMaterial.WHITE_SHULKER_BOX || material == CompatibleMaterial.YELLOW_SHULKER_BOX)))
|
||||
|| material == CompatibleMaterial.WHITE_SHULKER_BOX || material == CompatibleMaterial.YELLOW_SHULKER_BOX))
|
||||
|| ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14) && material == CompatibleMaterial.BARREL)
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
}
|
||||
|
||||
@PermissionHandler
|
||||
public void onInteractEntity(PlayerInteractEntityEvent event) {
|
||||
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (event.getRightClicked().getType() == EntityType.ITEM_FRAME
|
||||
|
@ -2,7 +2,7 @@ ClassLocalization:
|
||||
Materials:
|
||||
IslandRoles:
|
||||
Coop: 'Coop'
|
||||
Visitor: 'Visitor'
|
||||
Visitor: 'Visitor'
|
||||
Member: 'Member'
|
||||
Operator: 'Operator'
|
||||
Owner: 'Owner'
|
||||
@ -175,7 +175,7 @@ Command:
|
||||
Message: '&f&oManage stackables'
|
||||
Target:
|
||||
None: '&bSkyBlock &8| &cError&8: &eYou must be looking at a block.'
|
||||
Unstackable: '&bSkyBlock &8| &cError&8: &eUnable to target unstackable block.'
|
||||
Unstackable: '&bSkyBlock &8| &cError&8: &eUnable to target unstackable block.'
|
||||
Remove-Stack: '&bSkyBlock &8| &aInfo&8: &eSuccessfully removed stack if one was present.'
|
||||
Setsize:
|
||||
No-Arguments: '&bSkyBlock &8| &cError&8: &ePlease input a number that will become the new stack size.'
|
||||
@ -1393,6 +1393,10 @@ Menu:
|
||||
- '&7they explore your Island.'
|
||||
- ''
|
||||
- '&eClick to Edit Settings!'
|
||||
Next:
|
||||
Displayname: '&aNext Page'
|
||||
Last:
|
||||
Displayname: '&aLast Page'
|
||||
Exit:
|
||||
Displayname: '&cClick to Exit'
|
||||
Coop:
|
||||
|
Loading…
Reference in New Issue
Block a user