mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-01-25 08:51:33 +01:00
Merge branch 'master' into dev-bank
This commit is contained in:
commit
fa94a0f272
14
README.md
14
README.md
@ -5,12 +5,13 @@ Forked from [FabledSkyBlock](https://gitlab.com/Songoda/fabledskyblock)
|
||||
This fork contains bug fixes, features and improvements:
|
||||
- Added option to check location security when using `/is visit`
|
||||
- Added option to remove water from Island Spawn
|
||||
- Added an option to toggle fall damage in certain conditions like when using `/is home`
|
||||
- Added option to have Members, Operators and Owners all responding to Members settings as a temporary fix to Operators and Owners settings not being editable via GUI
|
||||
- Added option to toggle fall damage in certain conditions like when using `/is home`
|
||||
- Added per-world generator (editable only from generators.yml, GUI not supported yet)
|
||||
- Added a "subtract" value to levels in order to have all the new islands to level 0
|
||||
- Added option to set default WorldBorder status
|
||||
- Added permissions for WorldBorder colors
|
||||
- Added permission to bypass `/is kick`
|
||||
- Added permissions to bypass kick and ban
|
||||
- Added water in Nether mechanics!
|
||||
- Added option to let slime splitting bypass limits.yml
|
||||
- Added option to define distance between islands
|
||||
@ -19,8 +20,17 @@ This fork contains bug fixes, features and improvements:
|
||||
- Fixed bugs in Challenges that didn't remove all the items
|
||||
- Fixed WorldBorder size not reflecting real island size
|
||||
- Fixed bugs in island settings that prevented the from loading correctly
|
||||
- Fixed mob grief setting
|
||||
- Fixed explosion setting
|
||||
- Fixed damage setting
|
||||
- Fixed use portal setting
|
||||
- Fixed bank that couldn't be opened from Members
|
||||
- Fixed message telling that island disappeared on login
|
||||
- Fixed GUI menus that had used the same page variable
|
||||
- Fixed stackable bypassing break setting
|
||||
- Now you can use `/is chat <message>` to send messages to island chat
|
||||
- Now Challenges can be per-island too
|
||||
- Now hunger setting works as intended
|
||||
- Hide options in control panel if missing the permission
|
||||
- Hide vanished players from visitors list
|
||||
- Hide bank from leaderboard if disabled
|
||||
|
8
pom.xml
8
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>skyblock</artifactId>
|
||||
<version>2.2.16-LaborPatch-0.0.5</version>
|
||||
<version>2.3.3-DEV</version>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
@ -190,5 +190,11 @@
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.Zrips</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
<scope>provided</scope>
|
||||
<version>4.9.0.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -459,7 +459,8 @@ public class Island {
|
||||
*/
|
||||
public void load() {
|
||||
if (this.handle == null) {
|
||||
this.handle = SkyBlockAPI.getImplementation().getIslandManager().loadIsland(player);
|
||||
SkyBlockAPI.getImplementation().getIslandManager().loadIsland(player);
|
||||
this.handle = SkyBlockAPI.getImplementation().getIslandManager().getIsland(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,10 @@ public class BankManager {
|
||||
}
|
||||
|
||||
public List<Transaction> getTransactionList(Player player) {
|
||||
return log.get(player.getUniqueId());
|
||||
return getTransactionList(player.getUniqueId());
|
||||
}
|
||||
|
||||
public List<Transaction> getTransactionList(UUID uuid) {
|
||||
return log.get(uuid);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -18,7 +20,6 @@ import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import com.songoda.skyblock.api.SkyBlockAPI;
|
||||
import com.songoda.skyblock.api.island.Island;
|
||||
|
||||
public class Challenge {
|
||||
private ChallengeCategory category;
|
||||
@ -240,11 +241,12 @@ public class Challenge {
|
||||
public boolean has(Player p, Object obj) {
|
||||
// Check if the level of player's island is greater or equals to the required
|
||||
// level
|
||||
Island is = SkyBlockAPI.getIslandManager().getIsland(p);
|
||||
Island is = SkyBlock.getInstance().getIslandManager().getIsland(p);
|
||||
// Player doesn't have an island
|
||||
if (is == null)
|
||||
return false;
|
||||
return is.getLevel().getLevel() >= (Integer) obj;
|
||||
if (is != null && obj instanceof Number) {
|
||||
return is.getLevel().getLevel() >= ((Number) obj).longValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,7 +68,8 @@ public class DeleteCommand extends SubCommand {
|
||||
configLoad.getString("Command.Island.Admin.Delete.Owner.Message"));
|
||||
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
Island island = islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(targetPlayerUUID));
|
||||
islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(targetPlayerUUID));
|
||||
Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(targetPlayerUUID));
|
||||
Location spawnLocation = LocationUtil.getSpawnLocation();
|
||||
|
||||
if (spawnLocation != null && islandManager.isLocationAtIsland(island, spawnLocation)) {
|
||||
|
@ -8,6 +8,7 @@ import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -39,9 +40,10 @@ public class ProxyCommand extends SubCommand {
|
||||
|
||||
if (args.length == 1) {
|
||||
OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]);
|
||||
|
||||
UUID islandOwnerUUID = targetPlayerOffline.getOwner();
|
||||
|
||||
if (islandManager.containsIsland(islandOwnerUUID)) {
|
||||
if (islandManager.getIsland(Bukkit.getOfflinePlayer(islandOwnerUUID)) != null) {
|
||||
if (islandManager.isPlayerProxyingAnotherPlayer(((Player)sender).getUniqueId())) {
|
||||
messageManager.sendMessage(sender,
|
||||
configLoad.getString("Command.Island.Admin.Proxy.IsOffPlayer.Message")
|
||||
|
@ -79,7 +79,8 @@ public class SetBiomeCommand extends SubCommand {
|
||||
biomeManager.setBiome(island, biome.getBiome());
|
||||
island.setBiome(biome.getBiome());
|
||||
} else {
|
||||
Island island = islandManager.loadIsland(Bukkit.getOfflinePlayer(islandOwnerUUID));
|
||||
islandManager.loadIsland(Bukkit.getOfflinePlayer(islandOwnerUUID));
|
||||
Island island = islandManager.getIsland(Bukkit.getOfflinePlayer(islandOwnerUUID));
|
||||
if (island == null) {
|
||||
messageManager.sendMessage(sender,
|
||||
configLoad.getString("Command.Island.Admin.SetBiome.Island.Data.Message"));
|
||||
|
@ -2,7 +2,7 @@ package com.songoda.skyblock.command.commands.admin;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.menus.admin.Settings;
|
||||
import com.songoda.skyblock.gui.GuiPermissionsSelector;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -13,7 +13,7 @@ public class SettingsCommand extends SubCommand {
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
|
||||
Settings.getInstance().open(player, Settings.Type.Categories, null);
|
||||
skyblock.getGuiManager().showGUI(player, new GuiPermissionsSelector(skyblock, null, null));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,8 @@ public class AcceptCommand extends SubCommand {
|
||||
island = islandManager
|
||||
.getIsland(Bukkit.getServer().getOfflinePlayer(invite.getOwnerUUID()));
|
||||
} else {
|
||||
island = islandManager
|
||||
.loadIsland(Bukkit.getServer().getOfflinePlayer(invite.getOwnerUUID()));
|
||||
islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(invite.getOwnerUUID()));
|
||||
island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(invite.getOwnerUUID()));
|
||||
unloadIsland = true;
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,7 @@ public class KickCommand extends SubCommand {
|
||||
targetPlayerName = targetPlayer.getName();
|
||||
}
|
||||
|
||||
assert targetPlayer != null;
|
||||
if((targetPlayer.hasPermission("fabledskyblock.bypass.kick") || targetPlayer.isOp()) && islandVisitors.contains(targetPlayer.getUniqueId())){
|
||||
if(targetPlayer != null && (targetPlayer.hasPermission("fabledskyblock.bypass.kick") || targetPlayer.isOp()) && islandVisitors.contains(targetPlayer.getUniqueId())){
|
||||
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Exempt"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if (targetPlayerUUID.equals(player.getUniqueId())) {
|
||||
@ -85,7 +84,7 @@ public class KickCommand extends SubCommand {
|
||||
} else if (island.getOwnerUUID().equals(targetPlayerUUID)) {
|
||||
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Role.Owner.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if (island.isOpen() && islandVisitors.contains(targetPlayerUUID) && targetPlayer != null) {
|
||||
} else if (island.isOpen() && islandVisitors.contains(targetPlayerUUID)) {
|
||||
if (island.isCoopPlayer(targetPlayerUUID)) {
|
||||
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Cooped.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
|
@ -98,7 +98,7 @@ public class FileManager {
|
||||
}
|
||||
|
||||
if (configFile.exists()) {
|
||||
if (fileName.equals("config.yml") || fileName.equals("language.yml") || fileName.equals("settings.yml") || fileName.equals("worlds.yml")) {
|
||||
if (fileName.equals("config.yml") || fileName.equals("language.yml") || fileName.equals("worlds.yml")) {
|
||||
FileChecker fileChecker;
|
||||
|
||||
if (fileName.equals("config.yml")) {
|
||||
|
126
src/main/java/com/songoda/skyblock/gui/GuiAdminPermissions.java
Normal file
126
src/main/java/com/songoda/skyblock/gui/GuiAdminPermissions.java
Normal file
@ -0,0 +1,126 @@
|
||||
package com.songoda.skyblock.gui;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.core.gui.Gui;
|
||||
import com.songoda.core.gui.GuiUtils;
|
||||
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.IslandPermission;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.permission.BasicPermission;
|
||||
import com.songoda.skyblock.permission.PermissionManager;
|
||||
import com.songoda.skyblock.permission.PermissionType;
|
||||
import com.songoda.skyblock.visit.Visit;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GuiAdminPermissions extends Gui {
|
||||
|
||||
private final PermissionManager permissionManager;
|
||||
private final IslandRole role;
|
||||
private final FileConfiguration configLoad;
|
||||
private final FileManager.Config settingsConfig;
|
||||
private final FileConfiguration settingsConfigLoad;
|
||||
private final Gui returnGui;
|
||||
|
||||
public GuiAdminPermissions(SkyBlock plugin, IslandRole role, Gui returnGui) {
|
||||
super(6, returnGui);
|
||||
this.permissionManager = plugin.getPermissionManager();
|
||||
this.role = role;
|
||||
this.returnGui = returnGui;
|
||||
this.configLoad = plugin.getFileManager()
|
||||
.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
settingsConfig = plugin.getFileManager()
|
||||
.getConfig(new File(plugin.getDataFolder(), "settings.yml"));
|
||||
settingsConfigLoad = settingsConfig.getFileConfiguration();
|
||||
setTitle(TextUtils.formatText(configLoad.getString("Menu.Settings." + role.name() + ".Title")));
|
||||
setDefaultItem(null);
|
||||
paint();
|
||||
}
|
||||
|
||||
public void paint() {
|
||||
if (inventory != null)
|
||||
inventory.clear();
|
||||
setActionForRange(0, 0, 5, 9, null);
|
||||
|
||||
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"))), (event) -> {
|
||||
CompatibleSound.BLOCK_CHEST_CLOSE.play(event.player);
|
||||
guiManager.showGUI(event.player, returnGui);
|
||||
});
|
||||
|
||||
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"))), (event) -> {
|
||||
CompatibleSound.BLOCK_CHEST_CLOSE.play(event.player);
|
||||
guiManager.showGUI(event.player, returnGui);
|
||||
});
|
||||
|
||||
List<BasicPermission> permissions = permissionManager.getPermissions().stream()
|
||||
.filter(p -> p.getType() == getType(role))
|
||||
.collect(Collectors.toList());
|
||||
double itemCount = permissions.size();
|
||||
this.pages = (int) Math.max(1, Math.ceil(itemCount / 36));
|
||||
|
||||
if (page != 1)
|
||||
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,
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Next.Displayname"))),
|
||||
(event) -> {
|
||||
page++;
|
||||
paint();
|
||||
});
|
||||
|
||||
for (int i = 9; i < 45; i++) {
|
||||
int current = ((page - 1) * 36) - 9;
|
||||
if (current + i >= permissions.size()) {
|
||||
setItem(i, null);
|
||||
continue;
|
||||
}
|
||||
BasicPermission permission = permissions.get(current + i);
|
||||
if (permission == null) continue;
|
||||
|
||||
final String path = "Settings." + role.name() + "." + permission.getName();
|
||||
boolean setting = settingsConfigLoad.getBoolean(path);
|
||||
setButton(i, permission.getItem(setting, role), (event) -> {
|
||||
settingsConfigLoad.set(path, !setting);
|
||||
try {
|
||||
settingsConfigLoad.save(settingsConfig.getFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
paint();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public PermissionType getType(IslandRole role) {
|
||||
switch (role) {
|
||||
default:
|
||||
case Visitor:
|
||||
case Member:
|
||||
case Coop:
|
||||
return PermissionType.GENERIC;
|
||||
case Operator:
|
||||
return PermissionType.OPERATOR;
|
||||
case Owner:
|
||||
return PermissionType.ISLAND;
|
||||
}
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class GuiPermissions extends Gui {
|
||||
|
||||
private SkyBlock plugin;
|
||||
private final SkyBlock plugin;
|
||||
private final PermissionManager permissionManager;
|
||||
private final IslandRole role;
|
||||
private final Island island;
|
||||
@ -63,17 +63,13 @@ public class GuiPermissions extends Gui {
|
||||
setButton(5, GuiUtils.createButtonItem(CompatibleMaterial.MAP,
|
||||
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 GuiWelcomeEditor(plugin, this, island));
|
||||
});
|
||||
(event) -> guiManager.showGUI(event.player, new GuiWelcomeEditor(plugin, this, island)));
|
||||
|
||||
if (config.getFileConfiguration().getBoolean("Island.Visitor.Signature.Enable")) {
|
||||
setButton(3, GuiUtils.createButtonItem(CompatibleMaterial.PAPER,
|
||||
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 GuiSignatureEditor(plugin, this, island));
|
||||
});
|
||||
(event) -> guiManager.showGUI(event.player, new GuiSignatureEditor(plugin, this, island)));
|
||||
}
|
||||
|
||||
Visit visit = island.getVisit();
|
||||
|
@ -11,54 +11,68 @@ import com.songoda.skyblock.island.IslandRole;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
|
||||
public class GuiPermissionsSelector extends Gui {
|
||||
|
||||
public GuiPermissionsSelector(SkyBlock plugin, Island island, Gui returnGui) {
|
||||
public GuiPermissionsSelector(@Nonnull SkyBlock plugin, @Nullable Island island, @Nullable Gui returnGui) {
|
||||
super(1, returnGui);
|
||||
setDefaultItem(null);
|
||||
|
||||
String admin = island == null ? "Admin." : "";
|
||||
|
||||
FileConfiguration configLoad = plugin.getFileManager()
|
||||
.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
|
||||
setTitle(ChatColor.translateAlternateColorCodes('&',
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Title"))));
|
||||
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Title"))));
|
||||
|
||||
setButton(2, GuiUtils.createButtonItem(CompatibleMaterial.OAK_SIGN,
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Visitor.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu.Settings.Categories.Item.Visitor.Lore"))), (event) ->
|
||||
guiManager.showGUI(event.player, new GuiPermissions(plugin, island, IslandRole.Visitor, this)));
|
||||
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Visitor.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu." + admin + "Settings.Categories.Item.Visitor.Lore"))), (event) ->
|
||||
guiManager.showGUI(event.player, island == null ?
|
||||
new GuiAdminPermissions(plugin, IslandRole.Visitor, this) :
|
||||
new GuiPermissions(plugin, island, IslandRole.Visitor, this)));
|
||||
|
||||
setButton(3, GuiUtils.createButtonItem(CompatibleMaterial.PAINTING,
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Member.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu.Settings.Categories.Item.Member.Lore"))), (event) ->
|
||||
guiManager.showGUI(event.player, new GuiPermissions(plugin, island, IslandRole.Member, this)));
|
||||
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Member.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu." + admin + "Settings.Categories.Item.Member.Lore"))), (event) ->
|
||||
guiManager.showGUI(event.player, island == null ?
|
||||
new GuiAdminPermissions(plugin, IslandRole.Member, this) :
|
||||
new GuiPermissions(plugin, island, IslandRole.Member, this)));
|
||||
|
||||
setButton(4, GuiUtils.createButtonItem(CompatibleMaterial.ITEM_FRAME,
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Operator.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu.Settings.Categories.Item.Operator.Lore"))), (event) ->
|
||||
guiManager.showGUI(event.player, new GuiPermissions(plugin, island, IslandRole.Operator, this)));
|
||||
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Operator.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu." + admin + "Settings.Categories.Item.Operator.Lore"))), (event) ->
|
||||
guiManager.showGUI(event.player, island == null ?
|
||||
new GuiAdminPermissions(plugin, IslandRole.Operator, this) :
|
||||
new GuiPermissions(plugin, island, IslandRole.Operator, this)));
|
||||
|
||||
boolean isCoop = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Coop.Enable");
|
||||
|
||||
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"))), (event) -> {
|
||||
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Exit.Displayname"))), (event) -> {
|
||||
CompatibleSound.BLOCK_CHEST_CLOSE.play(event.player);
|
||||
event.player.closeInventory();
|
||||
});
|
||||
|
||||
if (isCoop)
|
||||
setButton(6, GuiUtils.createButtonItem(CompatibleMaterial.NAME_TAG,
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Coop.Displayname")),
|
||||
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Coop.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu.Settings.Categories.Item.Coop.Lore"))), (event) ->
|
||||
guiManager.showGUI(event.player, new GuiPermissions(plugin, island, IslandRole.Coop, this)));
|
||||
guiManager.showGUI(event.player, island == null ?
|
||||
new GuiAdminPermissions(plugin, IslandRole.Coop, this) :
|
||||
new GuiPermissions(plugin, island, IslandRole.Coop, this)));
|
||||
|
||||
setButton(isCoop ? 7 : 8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_SAPLING.getItem(),
|
||||
TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Owner.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu.Settings.Categories.Item.Owner.Lore"))), (event) ->
|
||||
guiManager.showGUI(event.player, new GuiPermissions(plugin, island, IslandRole.Owner, this)));
|
||||
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Owner.Displayname")),
|
||||
TextUtils.formatText(configLoad.getStringList("Menu." + admin + "Settings.Categories.Item.Owner.Lore"))), (event) ->
|
||||
guiManager.showGUI(event.player, island == null ?
|
||||
new GuiAdminPermissions(plugin, IslandRole.Owner, this) :
|
||||
new GuiPermissions(plugin, island, IslandRole.Owner, this)));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import org.bukkit.WeatherType;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -537,6 +538,9 @@ public class Island {
|
||||
}
|
||||
|
||||
public IslandRole getRole(OfflinePlayer player) {
|
||||
if(isCoopPlayer(player.getUniqueId())){
|
||||
return IslandRole.Coop; // TODO Rework Coop status - Fabrimat
|
||||
}
|
||||
for (IslandRole role : IslandRole.values())
|
||||
if (getRole(role).contains(player.getUniqueId()))
|
||||
return role;
|
||||
@ -808,7 +812,7 @@ public class Island {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
public synchronized void save() {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
|
||||
Config config = fileManager
|
||||
@ -861,7 +865,7 @@ public class Island {
|
||||
getLevel().save();
|
||||
}
|
||||
|
||||
public boolean isRegionUnlocked(Player player, String type) {
|
||||
public boolean isRegionUnlocked(Player player, IslandWorld type) {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
@ -871,22 +875,26 @@ public class Island {
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"),
|
||||
ownerUUID.toString() + ".yml"));
|
||||
FileConfiguration configLoadIslandData = islandData.getFileConfiguration();
|
||||
double price = configLoad.getDouble("Island.World." + type + ".UnlockPrice");
|
||||
double price = configLoad.getDouble("Island.World." + type.name() + ".UnlockPrice");
|
||||
|
||||
boolean unlocked = configLoadIslandData.getBoolean("Unlocked." + type);
|
||||
boolean unlocked = configLoadIslandData.getBoolean("Unlocked." + type.name());
|
||||
if (price == -1) {
|
||||
configLoadIslandData.set("Unlocked." + type, true);
|
||||
configLoadIslandData.set("Unlocked." + type.name(), true);
|
||||
unlocked = true;
|
||||
}
|
||||
|
||||
if (!unlocked) {
|
||||
messageManager.sendMessage(player,
|
||||
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Unlock." + type + ".Message").replace(
|
||||
.getString("Island.Unlock." + type.name() + ".Message").replace(
|
||||
"%cost%", NumberUtil.formatNumberByDecimal(price)));
|
||||
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
player.setVelocity(player.getLocation().getDirection().multiply(-.50));
|
||||
if(type.equals(IslandWorld.End)){
|
||||
player.setVelocity(player.getLocation().getDirection().multiply(-.50).setY(.6f));
|
||||
} else if(type.equals(IslandWorld.Nether)) {
|
||||
player.setVelocity(player.getLocation().getDirection().multiply(-.50));
|
||||
}
|
||||
}
|
||||
return unlocked;
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package com.songoda.skyblock.island;
|
||||
|
||||
import com.bekvon.bukkit.residence.Residence;
|
||||
import com.bekvon.bukkit.residence.api.ResidenceApi;
|
||||
import com.bekvon.bukkit.residence.containers.Flags;
|
||||
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
@ -47,6 +51,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -97,7 +102,7 @@ public class IslandManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveNextAvailableLocation(IslandWorld world) {
|
||||
public synchronized void saveNextAvailableLocation(IslandWorld world) {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "worlds.yml"));
|
||||
|
||||
@ -119,7 +124,7 @@ public class IslandManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void setNextAvailableLocation(IslandWorld world, org.bukkit.Location location) {
|
||||
public synchronized void setNextAvailableLocation(IslandWorld world, org.bukkit.Location location) {
|
||||
for (IslandPosition islandPositionList : islandPositions) {
|
||||
if (islandPositionList.getWorld() == world) {
|
||||
islandPositionList.setX(location.getX());
|
||||
@ -129,7 +134,7 @@ public class IslandManager {
|
||||
}
|
||||
|
||||
|
||||
public org.bukkit.Location prepareNextAvailableLocation(IslandWorld world) {
|
||||
public synchronized org.bukkit.Location prepareNextAvailableLocation(IslandWorld world) {
|
||||
for (IslandPosition islandPositionList : islandPositions) {
|
||||
if (islandPositionList.getWorld() == world) {
|
||||
|
||||
@ -191,7 +196,7 @@ public class IslandManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean createIsland(Player player, Structure structure) {
|
||||
public synchronized boolean createIsland(Player player, Structure structure) {
|
||||
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
|
||||
VisitManager visitManager = skyblock.getVisitManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
@ -291,7 +296,7 @@ public class IslandManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean previewIsland(Player player, Structure structure) {
|
||||
public synchronized boolean previewIsland(Player player, Structure structure) {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
|
||||
PlayerData data = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
@ -402,7 +407,7 @@ public class IslandManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void giveOwnership(Island island, org.bukkit.OfflinePlayer player) {
|
||||
public synchronized void giveOwnership(Island island, org.bukkit.OfflinePlayer player) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
CooldownManager cooldownManager = skyblock.getCooldownManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
@ -524,7 +529,7 @@ public class IslandManager {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean deleteIsland(Island island, boolean force) {
|
||||
public synchronized boolean deleteIsland(Island island, boolean force) {
|
||||
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
CooldownManager cooldownManager = skyblock.getCooldownManager();
|
||||
@ -652,7 +657,7 @@ public class IslandManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void deleteIslandData(UUID uuid) {
|
||||
public synchronized void deleteIslandData(UUID uuid) {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
fileManager.deleteConfig(new File(skyblock.getDataFolder().toString() + "/island-data", uuid.toString() + ".yml"));
|
||||
fileManager.deleteConfig(new File(skyblock.getDataFolder().toString() + "/ban-data", uuid.toString() + ".yml"));
|
||||
@ -666,7 +671,7 @@ public class IslandManager {
|
||||
}
|
||||
}
|
||||
|
||||
public Island loadIsland(org.bukkit.OfflinePlayer player) {
|
||||
public void loadIsland(org.bukkit.OfflinePlayer player) {
|
||||
VisitManager visitManager = skyblock.getVisitManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
BanManager banManager = skyblock.getBanManager();
|
||||
@ -681,7 +686,7 @@ public class IslandManager {
|
||||
deleteIslandData(player.getUniqueId());
|
||||
configLoad.set("Island.Owner", null);
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
islandOwnerUUID = player.getUniqueId();
|
||||
@ -693,7 +698,8 @@ public class IslandManager {
|
||||
|
||||
if (islandOwnerUUID != null) {
|
||||
if (containsIsland(islandOwnerUUID)) {
|
||||
return getIsland(player);
|
||||
//return getIsland(player);
|
||||
return;
|
||||
} else {
|
||||
config = fileManager.getConfig(new File(skyblock.getDataFolder().toString() + "/island-data", islandOwnerUUID.toString() + ".yml"));
|
||||
|
||||
@ -701,7 +707,7 @@ public class IslandManager {
|
||||
deleteIslandData(islandOwnerUUID);
|
||||
configLoad.set("Island.Owner", null);
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
Island island = new Island(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
|
||||
@ -726,11 +732,9 @@ public class IslandManager {
|
||||
Bukkit.getScheduler().runTask(skyblock, () ->
|
||||
Bukkit.getServer().getPluginManager().callEvent(new IslandLoadEvent(island.getAPIWrapper())));
|
||||
|
||||
return island;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -781,11 +785,11 @@ public class IslandManager {
|
||||
oldSystemIslands.put(IslandWorld.End, endZ);
|
||||
}
|
||||
|
||||
public Island loadIslandAtLocation(Location location) {
|
||||
public void loadIslandAtLocation(Location location) {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
File configFile = new File(skyblock.getDataFolder().toString() + "/island-data");
|
||||
|
||||
if (!configFile.exists()) return null;
|
||||
if (!configFile.exists()) return;
|
||||
|
||||
for (File fileList : configFile.listFiles()) {
|
||||
if (fileList != null && fileList.getName().contains(".yml") && fileList.getName().length() > 35) {
|
||||
@ -802,7 +806,8 @@ public class IslandManager {
|
||||
|
||||
if (LocationUtil.isLocationAtLocationRadius(location, islandLocation, size)) {
|
||||
UUID islandOwnerUUID = UUID.fromString(fileList.getName().replace(".yml", ""));
|
||||
return this.loadIsland(Bukkit.getOfflinePlayer(islandOwnerUUID));
|
||||
// return this.loadIsland(Bukkit.getOfflinePlayer(islandOwnerUUID));
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -810,7 +815,7 @@ public class IslandManager {
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
public void unloadIsland(Island island, org.bukkit.OfflinePlayer player) {
|
||||
@ -1186,8 +1191,8 @@ public class IslandManager {
|
||||
return islandStorage.get(uuid);
|
||||
}
|
||||
|
||||
if (offlinePlayer.isOnline()) {
|
||||
Player player = offlinePlayer.getPlayer();
|
||||
Player player = offlinePlayer.getPlayer();
|
||||
if (offlinePlayer.isOnline() && player != null) {
|
||||
|
||||
if (playerDataManager.hasPlayerData(player)) {
|
||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||
@ -1198,6 +1203,7 @@ public class IslandManager {
|
||||
}
|
||||
} else {
|
||||
OfflinePlayer offlinePlayerData = new OfflinePlayer(offlinePlayer.getUniqueId());
|
||||
loadIsland(offlinePlayer);
|
||||
|
||||
if (offlinePlayerData.getOwner() != null && islandStorage.containsKey(offlinePlayer.getUniqueId())) {
|
||||
return islandStorage.get(offlinePlayerData.getOwner());
|
||||
@ -1380,6 +1386,16 @@ public class IslandManager {
|
||||
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR || player.hasPermission("essentials.fly") || player.hasPermission("cmi.command.fly"))
|
||||
return;
|
||||
|
||||
// Residence support
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("Residence") != null) {
|
||||
ClaimedResidence res = Residence.getInstance().getResidenceManagerAPI().getByLoc(player.getLocation());
|
||||
if(res != null){
|
||||
if (res.getPermissions().has(Flags.fly, false) || res.getPermissions().has(Flags.nofly, false)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Island island = getIslandAtLocation(player.getLocation());
|
||||
|
||||
UpgradeManager upgradeManager = skyblock.getUpgradeManager();
|
||||
|
@ -128,8 +128,8 @@ public class Block implements Listener {
|
||||
|
||||
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
|
||||
|
||||
if (LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))
|
||||
|| LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone())) {
|
||||
if (LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D)) || LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Visitor).clone().subtract(0.0D, 1.0D, 0.0D))
|
||||
|| LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world)) {
|
||||
if (configLoad.getBoolean("Island.Spawn.Protection")) {
|
||||
event.setCancelled(true);
|
||||
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Break.Message"));
|
||||
|
@ -6,6 +6,7 @@ import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.island.*;
|
||||
import com.songoda.skyblock.limit.impl.EntityLimitaton;
|
||||
import com.songoda.skyblock.stackable.Stackable;
|
||||
import com.songoda.skyblock.stackable.StackableManager;
|
||||
import com.songoda.skyblock.upgrade.Upgrade;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
@ -14,8 +15,10 @@ import com.songoda.skyblock.world.WorldManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -109,8 +112,15 @@ public class Entity implements Listener {
|
||||
|
||||
// Check permissions.
|
||||
skyblock.getPermissionManager()
|
||||
.processPermission(event, player, islandManager.getIslandAtLocation(player.getLocation()));
|
||||
.processPermission(event, player, islandManager.getIslandAtLocation(player.getLocation()), true);
|
||||
|
||||
} else if((event.getDamager() instanceof org.bukkit.entity.Projectile
|
||||
&& ((Projectile) event.getDamager()).getShooter() instanceof Player)
|
||||
&& (event.getEntity().getType().equals(EntityType.ARMOR_STAND)
|
||||
|| event.getEntity().getType().equals(EntityType.ITEM_FRAME))){
|
||||
Player player = (Player) ((Projectile) event.getDamager()).getShooter();
|
||||
skyblock.getPermissionManager()
|
||||
.processPermission(event, player, islandManager.getIslandAtLocation(player.getLocation()));
|
||||
} else { // Make it work with all the entities, not just TNT
|
||||
org.bukkit.entity.Entity entity = event.getEntity();
|
||||
|
||||
@ -296,7 +306,7 @@ public class Entity implements Listener {
|
||||
}
|
||||
|
||||
if ((event.getEntityType() == EntityType.FALLING_BLOCK)
|
||||
&& LocationUtil.isLocationLocation(event.getBlock().getLocation(), island.getLocation(world, IslandEnvironment.Main).clone())
|
||||
&& LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world)
|
||||
&& configLoad.getBoolean("Island.Spawn.Protection")) {
|
||||
FallingBlock fallingBlock = (FallingBlock) event.getEntity();
|
||||
if (fallingBlock.getDropItem()) {
|
||||
@ -335,21 +345,8 @@ public class Entity implements Listener {
|
||||
.getBoolean("Island.Block.Level.Enable"))
|
||||
return;
|
||||
|
||||
CompatibleMaterial materials = CompatibleMaterial.getBlockMaterial(block.getType());
|
||||
|
||||
if (materials != null) {
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
removeBlockFromLevel(island, block);
|
||||
CompatibleMaterial materials;
|
||||
|
||||
if (event.getTo() != null && event.getTo() != Material.AIR) {
|
||||
materials = CompatibleMaterial.getBlockMaterial(event.getTo());
|
||||
@ -369,7 +366,7 @@ public class Entity implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
org.bukkit.entity.Entity entity = event.getEntity();
|
||||
|
||||
@ -379,47 +376,91 @@ public class Entity implements Listener {
|
||||
if (skyblock.getWorldManager().isIslandWorld(entity.getWorld())) {
|
||||
// Check permissions.
|
||||
Island island = islandManager.getIslandAtLocation(entity.getLocation());
|
||||
|
||||
skyblock.getPermissionManager().processPermission(event, null, island);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
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();
|
||||
StackableManager stackableManager = skyblock.getStackableManager();
|
||||
|
||||
if (level.hasMaterial(materials.name())) {
|
||||
long materialAmount = level.getMaterialAmount(materials.name());
|
||||
boolean removed;
|
||||
Iterator<org.bukkit.block.Block> it = event.blockList().iterator();
|
||||
while (it.hasNext()){
|
||||
removed = false;
|
||||
org.bukkit.block.Block block = it.next();
|
||||
if (SkyBlock.getInstance().getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Spawn.Protection")) {
|
||||
IslandWorld world = worldManager.getIslandWorld(event.getEntity().getWorld());
|
||||
if (LocationUtil.isLocationLocation(block.getLocation(),
|
||||
island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))) {
|
||||
it.remove();
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (materialAmount - 1 <= 0) {
|
||||
level.removeMaterial(materials.name());
|
||||
} else {
|
||||
level.setMaterialAmount(materials.name(), materialAmount - 1);
|
||||
}
|
||||
Location blockLocation = block.getLocation();
|
||||
|
||||
if (stackableManager != null && stackableManager.isStacked(blockLocation)) {
|
||||
Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.getMaterial(block));
|
||||
if (stackable != null) {
|
||||
CompatibleMaterial material = CompatibleMaterial.getMaterial(block);
|
||||
byte data = block.getData();
|
||||
|
||||
int removedAmount = (int) (Math.random() * Math.min(64, stackable.getSize()-1));
|
||||
stackable.take(removedAmount);
|
||||
Bukkit.getScheduler().runTask(skyblock, () -> {
|
||||
block.getWorld().dropItemNaturally(blockLocation.clone().add(.5, 1, .5),
|
||||
new ItemStack(material.getMaterial(), (int) (Math.random() * removedAmount), data));
|
||||
});
|
||||
|
||||
if (stackable.getSize() <= 1) {
|
||||
stackableManager.removeStack(stackable);
|
||||
}
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
|
||||
removeBlockFromLevel(island, block);
|
||||
}
|
||||
|
||||
it.remove();
|
||||
if(!removed){
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Block.Level.Enable")) {
|
||||
if(!removed){
|
||||
removeBlockFromLevel(island, block);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeBlockFromLevel(Island island, CompatibleMaterial material){
|
||||
if (material != null) {
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
if (level.hasMaterial(material.name())) {
|
||||
long materialAmount = level.getMaterialAmount(material.name());
|
||||
|
||||
if (materialAmount - 1 <= 0) {
|
||||
level.removeMaterial(material.name());
|
||||
} else {
|
||||
level.setMaterialAmount(material.name(), materialAmount - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeBlockFromLevel(Island island, Block block) {
|
||||
removeBlockFromLevel(island, CompatibleMaterial.getBlockMaterial(block.getType()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
LivingEntity livingEntity = event.getEntity();
|
||||
|
@ -50,7 +50,8 @@ public class Join implements Listener {
|
||||
userCacheManager.saveAsync();
|
||||
|
||||
try {
|
||||
Island island = islandManager.loadIsland(player);
|
||||
islandManager.loadIsland(player);
|
||||
Island island = islandManager.getIsland(player);
|
||||
boolean teleportedToIsland = false;
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
|
@ -169,12 +169,18 @@ public class Move implements Listener {
|
||||
}
|
||||
|
||||
// Load the island they are now on if one exists
|
||||
if (player.hasPermission("fabledskyblock.bypass")) {
|
||||
Island loadedIsland = islandManager.loadIslandAtLocation(player.getLocation());
|
||||
if (loadedIsland != null) {
|
||||
islandManager.loadIslandAtLocation(player.getLocation());
|
||||
Island loadedIsland = islandManager.getIslandAtLocation(player.getLocation());
|
||||
if (loadedIsland != null) {
|
||||
if (player.hasPermission("fabledskyblock.bypass")) {
|
||||
playerData.setIsland(loadedIsland.getOwnerUUID());
|
||||
return;
|
||||
}
|
||||
|
||||
if(loadedIsland.isOpen()){
|
||||
loadedIsland.getVisit().addVisitor(player.getUniqueId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LocationUtil.teleportPlayerToSpawn(player);
|
||||
@ -235,7 +241,8 @@ public class Move implements Listener {
|
||||
final WorldManager worldManager = skyblock.getWorldManager();
|
||||
if(e.getTo() != null && e.getTo().getWorld() != null){
|
||||
e.getTo().getWorld().loadChunk(e.getTo().getChunk());
|
||||
if(worldManager.isIslandWorld(e.getTo().getWorld()) && e.getTo().distance(e.getFrom()) > 1.0d){ // We should not care of self block tp
|
||||
if(worldManager.isIslandWorld(e.getTo().getWorld())
|
||||
&& (!e.getTo().getWorld().equals(e.getFrom().getWorld()) || e.getTo().distance(e.getFrom()) > 1.0d)){ // We should not care of self block tp
|
||||
if(skyblock.getIslandManager().getIslandAtLocation(e.getTo()) == null){
|
||||
e.setCancelled(true);
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
|
@ -81,11 +81,6 @@ public class Portal implements Listener {
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
// Check permissions.
|
||||
if (!skyblock.getPermissionManager().processPermission(new PlayerEnterPortalEvent(player, player.getLocation()),
|
||||
player, island))
|
||||
return;
|
||||
|
||||
IslandEnvironment spawnEnvironment;
|
||||
switch (island.getRole(player)) {
|
||||
case Operator:
|
||||
@ -122,34 +117,43 @@ public class Portal implements Listener {
|
||||
|
||||
if (tick == null) return;
|
||||
|
||||
PlayerEnterPortalEvent playerEnterPortalEvent = new PlayerEnterPortalEvent(player, player.getLocation()); // TODO Why?? - Fabrimat
|
||||
// Check permissions.
|
||||
boolean perms = !skyblock.getPermissionManager().processPermission(playerEnterPortalEvent,
|
||||
player, island);
|
||||
|
||||
IslandWorld fromWorld = worldManager.getIslandWorld(player.getWorld());
|
||||
IslandWorld toWorld = IslandWorld.Normal;
|
||||
|
||||
if (CompatibleMaterial.getMaterial(block.getType()).equals(CompatibleMaterial.NETHER_PORTAL))
|
||||
if (block.getType().equals(CompatibleMaterial.NETHER_PORTAL.getMaterial())) {
|
||||
toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.Nether : IslandWorld.Normal;
|
||||
else if (CompatibleMaterial.getMaterial(block.getType()).equals(CompatibleMaterial.END_PORTAL))
|
||||
} else if (block.getType().equals(CompatibleMaterial.END_PORTAL.getMaterial())) {
|
||||
toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.End : IslandWorld.Normal;
|
||||
}
|
||||
|
||||
switch (toWorld) {
|
||||
case Nether:
|
||||
if (configLoad.getBoolean("Island.World.Nether.Enable") && island.isRegionUnlocked(player, "Nether")) {
|
||||
teleportPlayerToWorld(player, soundManager, island, spawnEnvironment, tick, toWorld);
|
||||
}
|
||||
break;
|
||||
if(!perms){
|
||||
switch (toWorld) {
|
||||
case End:
|
||||
case Nether:
|
||||
if (configLoad.getBoolean("Island.World." + toWorld.name() + ".Enable") && island.isRegionUnlocked(player, toWorld)) {
|
||||
teleportPlayerToWorld(player, soundManager, island, spawnEnvironment, tick, toWorld);
|
||||
}
|
||||
break;
|
||||
|
||||
case End:
|
||||
if (configLoad.getBoolean("Island.World.End.Enable") && island.isRegionUnlocked(player, "End")) {
|
||||
teleportPlayerToWorld(player, soundManager, island, spawnEnvironment, tick, toWorld);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
IslandWorld toWorldF = toWorld;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> player.teleport(island.getLocation(toWorldF, spawnEnvironment)), 1L);
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
|
||||
player.setFallDistance(0.0F);
|
||||
tick.setTick(1);
|
||||
break;
|
||||
default:
|
||||
IslandWorld toWorldF = toWorld;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> player.teleport(island.getLocation(toWorldF, spawnEnvironment)), 1L);
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
|
||||
player.setFallDistance(0.0F);
|
||||
tick.setTick(1);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if(toWorld.equals(IslandWorld.End)){
|
||||
player.setVelocity(player.getLocation().getDirection().multiply(-.50).setY(.6f));
|
||||
} else if(toWorld.equals(IslandWorld.Nether)) {
|
||||
player.setVelocity(player.getLocation().getDirection().multiply(-.50));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class Spawner implements Listener {
|
||||
spawner.setMaxSpawnDelay(400);
|
||||
} else {
|
||||
try {
|
||||
Object MobSpawner = null;
|
||||
Object MobSpawner;
|
||||
|
||||
try {
|
||||
Field TileEntityMobSpawnerField = spawner.getClass().getDeclaredField("spawner");
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.songoda.skyblock.listeners;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.api.event.player.PlayerIslandEnterEvent;
|
||||
@ -11,7 +12,6 @@ import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.permission.event.events.PlayerEnterPortalEvent;
|
||||
import com.songoda.skyblock.playerdata.PlayerData;
|
||||
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
@ -20,6 +20,7 @@ import com.songoda.skyblock.world.WorldManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -53,9 +54,33 @@ public class Teleport implements Listener {
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(skyblock, () -> islandManager.updateFlight(player), 1L);
|
||||
if(worldManager.isIslandWorld(event.getFrom().getWorld())
|
||||
|| (event.getTo() != null && worldManager.isIslandWorld(event.getTo().getWorld()))) {
|
||||
Bukkit.getScheduler().runTaskLater(skyblock, () -> islandManager.updateFlight(player), 1L);
|
||||
}
|
||||
islandManager.loadPlayer(player);
|
||||
|
||||
|
||||
// Fix for bug that tp you in the real Nether/End when entering in a portal in an island // TODO Simplify
|
||||
if (event.getTo() != null && (worldManager.isIslandWorld(event.getFrom().getWorld())
|
||||
&& !worldManager.isIslandWorld(event.getTo().getWorld())
|
||||
&& (event.getFrom().getBlock().getType().equals(CompatibleMaterial.END_PORTAL.getMaterial())
|
||||
|| event.getFrom().getBlock().getType().equals(CompatibleMaterial.NETHER_PORTAL.getMaterial()))
|
||||
&& (event.getTo().getWorld() != null
|
||||
&& event.getTo().getWorld().getEnvironment().equals(World.Environment.NETHER)
|
||||
|| event.getTo().getWorld().getEnvironment().equals(World.Environment.THE_END)))
|
||||
|| event.getTo() != null
|
||||
&& (worldManager.isIslandWorld(event.getFrom().getWorld())
|
||||
&& !worldManager.isIslandWorld(event.getTo().getWorld())
|
||||
&& (event.getCause().equals(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL)
|
||||
|| event.getCause().equals(PlayerTeleportEvent.TeleportCause.END_PORTAL)
|
||||
|| event.getCause().equals(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL))
|
||||
&& (event.getTo().getWorld() != null
|
||||
&& event.getTo().getWorld().getEnvironment().equals(World.Environment.NETHER)
|
||||
|| event.getTo().getWorld().getEnvironment().equals(World.Environment.THE_END)))) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (worldManager.isIslandWorld(player.getWorld())) {
|
||||
|
||||
com.songoda.skyblock.island.Island island = islandManager.getIslandAtLocation(event.getTo());
|
||||
|
@ -71,7 +71,7 @@ public class Bank {
|
||||
executors.put(MenuClickRegistry.RegistryKey.fromLanguageFile("Menu.Bank.Item.Deposit.Displayname", CompatibleMaterial.DIRT), (inst, player, e) -> {
|
||||
inst.getSoundManager().playSound(player, CompatibleSound.ENTITY_BAT_TAKEOFF.getSound(), 1.0F, 1.0F);
|
||||
//Deposit money
|
||||
Island island = islandManager.getIslandByPlayer(Bukkit.getOfflinePlayer(player.getUniqueId()));
|
||||
Island island = islandManager.getIsland(player);
|
||||
if (island != null) {
|
||||
SelectInputMethod.getInstance().open(player, "Deposit", (action) -> {
|
||||
if (action == InputMethodSelectlistener.InputMethod.CANCELED) {
|
||||
@ -153,18 +153,16 @@ public class Bank {
|
||||
executors.put(MenuClickRegistry.RegistryKey.fromLanguageFile("Menu.Bank.Item.Withdraw.Displayname", CompatibleMaterial.GLISTERING_MELON_SLICE), (inst, player, e) -> {
|
||||
inst.getSoundManager().playSound(player, CompatibleSound.ENTITY_BAT_TAKEOFF.getSound(), 1.0F, 1.0F);
|
||||
//Withdraw money
|
||||
Island island = null;
|
||||
island = islandManager.getIslandByPlayer(Bukkit.getOfflinePlayer(player.getUniqueId()));
|
||||
Island island;
|
||||
island = islandManager.getIsland(player);
|
||||
if (island != null) {
|
||||
Island finalIsland = island;
|
||||
SelectInputMethod.getInstance().open(player, "Withdraw", (action) -> {
|
||||
if (action == InputMethodSelectlistener.InputMethod.CANCELED) {
|
||||
Bukkit.getScheduler().runTask(skyblock, () -> {
|
||||
this.open(player);
|
||||
});
|
||||
return;
|
||||
} else if (action == InputMethodSelectlistener.InputMethod.ALL) {
|
||||
withdraw(player, finalIsland, finalIsland.getBankBalance());
|
||||
withdraw(player, island, island.getBankBalance());
|
||||
} else {
|
||||
ChatPrompt.showPrompt(skyblock, player, (event) -> {
|
||||
if (event.getMessage().equals(""))
|
||||
@ -176,7 +174,7 @@ public class Bank {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short4.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
}
|
||||
withdraw(player, finalIsland, amount);
|
||||
withdraw(player, island, amount);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -332,6 +332,8 @@ public class Levelling implements Listener {
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock,
|
||||
() -> open(player), 1L);
|
||||
|
||||
levellingManager.addWorth(materials, materialPoints);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock,
|
||||
() -> {
|
||||
Config config1 = fileManager.getConfig(new File(
|
||||
|
@ -1,686 +0,0 @@
|
||||
package com.songoda.skyblock.menus.admin;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.item.nInventoryUtil;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Settings {
|
||||
|
||||
private static Settings instance;
|
||||
|
||||
public static Settings getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new Settings();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void open(Player player, Settings.Type menuType, IslandRole role) {
|
||||
SkyBlock skyblock = SkyBlock.getInstance();
|
||||
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
|
||||
Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
Config languageConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = languageConfig.getFileConfiguration();
|
||||
|
||||
if (menuType == Settings.Type.Categories) {
|
||||
nInventoryUtil nInv = new nInventoryUtil(player, event -> {
|
||||
if (!(player.hasPermission("fabledskyblock.admin.settings") || player.hasPermission("fabledskyblock.admin.*")
|
||||
|| player.hasPermission("fabledskyblock.*"))) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Island.Admin.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack is = event.getItem();
|
||||
|
||||
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Exit.Displayname"))))) {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_CLOSE.getSound(), 1.0F, 1.0F);
|
||||
} else if ((is.hasItemMeta()) && (is.getItemMeta().getDisplayName()
|
||||
.equals(ChatColor.translateAlternateColorCodes('&', configLoad
|
||||
.getString("Menu.Admin.Settings.Categories.Item.Visitor.Displayname"))))) {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player, Type.Role, IslandRole.Visitor), 1L);
|
||||
} else if ((is.getType() == Material.PAINTING) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Member.Displayname"))))) {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player, Type.Role, IslandRole.Member), 1L);
|
||||
} else if ((is.getType() == Material.ITEM_FRAME) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName()
|
||||
.equals(ChatColor.translateAlternateColorCodes('&', configLoad
|
||||
.getString("Menu.Admin.Settings.Categories.Item.Operator.Displayname"))))) {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player, Type.Role, IslandRole.Operator), 1L);
|
||||
} else if ((is.getType() == Material.NAME_TAG) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Coop.Displayname"))))) {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player, Type.Role, IslandRole.Coop), 1L);
|
||||
} else if ((is.getType() == CompatibleMaterial.OAK_SAPLING.getMaterial()) && (is.hasItemMeta())
|
||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Owner.Displayname"))))) {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player, Type.Role, IslandRole.Owner), 1L);
|
||||
}
|
||||
});
|
||||
|
||||
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()),
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Visitor.Displayname"),
|
||||
configLoad.getStringList("Menu.Admin.Settings.Categories.Item.Visitor.Lore"), null, null, null), 2);
|
||||
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Member.Displayname"),
|
||||
configLoad.getStringList("Menu.Admin.Settings.Categories.Item.Member.Lore"), null, null, null), 3);
|
||||
nInv.addItem(nInv.createItem(new ItemStack(Material.ITEM_FRAME),
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Operator.Displayname"),
|
||||
configLoad.getStringList("Menu.Admin.Settings.Categories.Item.Operator.Lore"), null, null, null),
|
||||
4);
|
||||
|
||||
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Coop.Enable")) {
|
||||
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Exit.Displayname"), null, null, null,
|
||||
null), 0);
|
||||
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG),
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Coop.Displayname"),
|
||||
configLoad.getStringList("Menu.Admin.Settings.Categories.Item.Coop.Lore"), null, null, null),
|
||||
6);
|
||||
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(),
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Owner.Displayname"),
|
||||
configLoad.getStringList("Menu.Admin.Settings.Categories.Item.Owner.Lore"), null, null, null),
|
||||
7);
|
||||
} else {
|
||||
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Exit.Displayname"), null, null, null,
|
||||
null), 0, 8);
|
||||
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(),
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Item.Owner.Displayname"),
|
||||
configLoad.getStringList("Menu.Admin.Settings.Categories.Item.Owner.Lore"), null, null, null),
|
||||
6);
|
||||
}
|
||||
|
||||
nInv.setTitle(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings.Categories.Title")));
|
||||
nInv.setRows(1);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> nInv.open());
|
||||
} else if (menuType == Settings.Type.Role) {
|
||||
nInventoryUtil nInv = new nInventoryUtil(player, event -> {
|
||||
if (!(player.hasPermission("fabledskyblock.admin.settings") || player.hasPermission("fabledskyblock.admin.*")
|
||||
|| player.hasPermission("fabledskyblock.*"))) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Island.Admin.Settings.Permission.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack is = event.getItem();
|
||||
|
||||
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta()) && (is
|
||||
.getItemMeta().getDisplayName()
|
||||
.equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings.Visitor.Item.Return.Displayname")))
|
||||
|| is.getItemMeta().getDisplayName()
|
||||
.equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings.Member.Item.Return.Displayname")))
|
||||
|| is.getItemMeta().getDisplayName()
|
||||
.equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad
|
||||
.getString("Menu.Admin.Settings.Operator.Item.Return.Displayname")))
|
||||
|| is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings.Owner.Item.Return.Displayname"))))) {
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_ARROW_HIT.getSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player, Type.Categories, null), 1L);
|
||||
} else if (is.hasItemMeta()) {
|
||||
String roleName = getRoleName(role);
|
||||
|
||||
FileConfiguration settingsConfigLoad = skyblock.getFileManager()
|
||||
.getConfig(new File(skyblock.getDataFolder(), "settings.yml")).getFileConfiguration();
|
||||
|
||||
for (String settingList : settingsConfigLoad.getConfigurationSection("Settings." + role.name())
|
||||
.getKeys(false)) {
|
||||
if (is.getItemMeta().getDisplayName()
|
||||
.equals(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings." + roleName + ".Item.Setting."
|
||||
+ settingList + ".Displayname")))) {
|
||||
if (settingsConfigLoad.getBoolean("Settings." + role.name() + "." + settingList)) {
|
||||
settingsConfigLoad.set("Settings." + role.name() + "." + settingList, false);
|
||||
} else {
|
||||
settingsConfigLoad.set("Settings." + role.name() + "." + settingList, true);
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock, () -> {
|
||||
try {
|
||||
Config config = skyblock.getFileManager()
|
||||
.getConfig(new File(skyblock.getDataFolder(), "settings.yml"));
|
||||
config.getFileConfiguration().save(config.getFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_WOODEN_BUTTON_CLICK_ON.getSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player, Type.Role, role), 1L);
|
||||
}
|
||||
});
|
||||
|
||||
if (role == IslandRole.Visitor
|
||||
|| role == IslandRole.Member
|
||||
|| role == IslandRole.Coop) {
|
||||
nInv.addItemStack(createItem(role, "Destroy", new ItemStack(Material.DIAMOND_PICKAXE)), 9);
|
||||
nInv.addItemStack(createItem(role, "Place", new ItemStack(Material.GRASS)), 10);
|
||||
nInv.addItemStack(createItem(role, "Anvil", new ItemStack(Material.ANVIL)), 11);
|
||||
nInv.addItemStack(createItem(role, "ArmorStandUse", new ItemStack(Material.ARMOR_STAND)), 12);
|
||||
nInv.addItemStack(createItem(role, "Beacon", new ItemStack(Material.BEACON)), 13);
|
||||
nInv.addItemStack(createItem(role, "Bed", CompatibleMaterial.WHITE_BED.getItem()), 14);
|
||||
nInv.addItemStack(createItem(role, "AnimalBreeding", new ItemStack(Material.WHEAT)), 15);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "Brewing", new ItemStack(CompatibleMaterial.BREWING_STAND.getMaterial())),
|
||||
16);
|
||||
nInv.addItemStack(createItem(role, "Bucket", new ItemStack(Material.BUCKET)), 17);
|
||||
nInv.addItemStack(createItem(role, "WaterCollection", new ItemStack(Material.POTION)), 18);
|
||||
nInv.addItemStack(createItem(role, "Storage", new ItemStack(Material.CHEST)), 19);
|
||||
nInv.addItemStack(createItem(role, "Workbench", CompatibleMaterial.CRAFTING_TABLE.getItem()), 20);
|
||||
nInv.addItemStack(createItem(role, "Crop", CompatibleMaterial.WHEAT_SEEDS.getItem()), 21);
|
||||
nInv.addItemStack(createItem(role, "Door", CompatibleMaterial.OAK_DOOR.getItem()), 22);
|
||||
nInv.addItemStack(createItem(role, "Gate", CompatibleMaterial.OAK_FENCE_GATE.getItem()), 23);
|
||||
nInv.addItemStack(createItem(role, "Projectile", new ItemStack(Material.ARROW)), 24);
|
||||
nInv.addItemStack(createItem(role, "Enchant", CompatibleMaterial.ENCHANTING_TABLE.getItem()), 25);
|
||||
nInv.addItemStack(createItem(role, "Fire", new ItemStack(Material.FLINT_AND_STEEL)), 26);
|
||||
nInv.addItemStack(createItem(role, "Furnace", new ItemStack(Material.FURNACE)), 27);
|
||||
nInv.addItemStack(createItem(role, "HorseInventory", CompatibleMaterial.CHEST_MINECART.getItem()), 28);
|
||||
nInv.addItemStack(createItem(role, "MobRiding", new ItemStack(Material.SADDLE)), 29);
|
||||
nInv.addItemStack(createItem(role, "MonsterHurting", CompatibleMaterial.BONE.getItem()), 30);
|
||||
nInv.addItemStack(createItem(role, "MobHurting", CompatibleMaterial.WOODEN_SWORD.getItem()), 31);
|
||||
nInv.addItemStack(createItem(role, "MobTaming", CompatibleMaterial.POPPY.getItem()), 32);
|
||||
nInv.addItemStack(createItem(role, "Leash", CompatibleMaterial.LEAD.getItem()), 33);
|
||||
nInv.addItemStack(createItem(role, "LeverButton", new ItemStack(Material.LEVER)), 34);
|
||||
nInv.addItemStack(createItem(role, "Milking", new ItemStack(Material.MILK_BUCKET)), 35);
|
||||
nInv.addItemStack(createItem(role, "Jukebox", new ItemStack(Material.JUKEBOX)), 36);
|
||||
nInv.addItemStack(createItem(role, "PressurePlate", CompatibleMaterial.OAK_PRESSURE_PLATE.getItem()), 37);
|
||||
nInv.addItemStack(createItem(role, "Redstone", new ItemStack(Material.REDSTONE)), 38);
|
||||
nInv.addItemStack(createItem(role, "Shearing", new ItemStack(Material.SHEARS)), 39);
|
||||
nInv.addItemStack(createItem(role, "Trading", new ItemStack(Material.EMERALD)), 40);
|
||||
nInv.addItemStack(createItem(role, "ItemDrop", new ItemStack(Material.PUMPKIN_SEEDS)), 41);
|
||||
nInv.addItemStack(createItem(role, "ItemPickup", new ItemStack(Material.MELON_SEEDS)), 42);
|
||||
nInv.addItemStack(createItem(role, "Fishing", new ItemStack(Material.FISHING_ROD)), 43);
|
||||
nInv.addItemStack(createItem(role, "DropperDispenser", new ItemStack(Material.DISPENSER)), 44);
|
||||
nInv.addItemStack(createItem(role, "SpawnEgg", new ItemStack(Material.EGG)), 45);
|
||||
nInv.addItemStack(createItem(role, "HangingDestroy", new ItemStack(Material.ITEM_FRAME)), 46);
|
||||
nInv.addItemStack(createItem(role, "Cake", new ItemStack(Material.CAKE)), 47);
|
||||
nInv.addItemStack(createItem(role, "DragonEggUse", new ItemStack(Material.DRAGON_EGG)), 48);
|
||||
nInv.addItemStack(createItem(role, "MinecartBoat", new ItemStack(Material.MINECART)), 49);
|
||||
nInv.addItemStack(createItem(role, "Portal", new ItemStack(Material.ENDER_PEARL)), 50);
|
||||
nInv.addItemStack(createItem(role, "Hopper", new ItemStack(Material.HOPPER)), 51);
|
||||
nInv.addItemStack(createItem(role, "EntityPlacement", new ItemStack(Material.ARMOR_STAND)), 52);
|
||||
nInv.addItemStack(createItem(role, "ExperienceOrbPickup", CompatibleMaterial.EXPERIENCE_BOTTLE.getItem()), 53);
|
||||
|
||||
nInv.setRows(6);
|
||||
} else if (role == IslandRole.Operator) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Visitor.Banning")) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Coop.Enable")) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
|
||||
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
|
||||
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 10);
|
||||
nInv.addItemStack(createItem(role, "Ban", new ItemStack(Material.IRON_AXE)), 11);
|
||||
nInv.addItemStack(createItem(role, "Unban", CompatibleMaterial.RED_DYE.getItem()), 12);
|
||||
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 13);
|
||||
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 14);
|
||||
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 15);
|
||||
nInv.addItemStack(createItem(role, "Coop", new ItemStack(Material.NAME_TAG)), 16);
|
||||
nInv.addItemStack(createItem(role, "CoopPlayers", new ItemStack(Material.BOOK)), 17);
|
||||
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
|
||||
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
|
||||
21);
|
||||
nInv.addItemStack(createItem(role, "Border", new ItemStack(Material.BEACON)), 22);
|
||||
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
|
||||
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
|
||||
} else {
|
||||
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
|
||||
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 10);
|
||||
nInv.addItemStack(createItem(role, "Ban", new ItemStack(Material.IRON_AXE)), 11);
|
||||
nInv.addItemStack(createItem(role, "Unban", CompatibleMaterial.RED_DYE.getItem()), 12);
|
||||
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 13);
|
||||
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 14);
|
||||
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 15);
|
||||
nInv.addItemStack(createItem(role, "Coop", new ItemStack(Material.NAME_TAG)), 16);
|
||||
nInv.addItemStack(createItem(role, "CoopPlayers", new ItemStack(Material.BOOK)), 17);
|
||||
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
|
||||
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
|
||||
21);
|
||||
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
|
||||
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
|
||||
}
|
||||
} else {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
|
||||
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
|
||||
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 11);
|
||||
nInv.addItemStack(createItem(role, "Ban", new ItemStack(Material.IRON_AXE)), 12);
|
||||
nInv.addItemStack(createItem(role, "Unban", CompatibleMaterial.RED_DYE.getItem()), 13);
|
||||
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 14);
|
||||
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 15);
|
||||
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 16);
|
||||
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
|
||||
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
|
||||
21);
|
||||
nInv.addItemStack(createItem(role, "Border", new ItemStack(Material.BEACON)), 22);
|
||||
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
|
||||
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
|
||||
} else {
|
||||
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
|
||||
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 11);
|
||||
nInv.addItemStack(createItem(role, "Ban", new ItemStack(Material.IRON_AXE)), 12);
|
||||
nInv.addItemStack(createItem(role, "Unban", CompatibleMaterial.RED_DYE.getItem()), 13);
|
||||
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 14);
|
||||
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 15);
|
||||
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 16);
|
||||
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
|
||||
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
|
||||
21);
|
||||
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
|
||||
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
|
||||
}
|
||||
}
|
||||
|
||||
nInv.setRows(3);
|
||||
} else {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Coop.Enable")) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
|
||||
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
|
||||
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 11);
|
||||
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 12);
|
||||
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 13);
|
||||
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 14);
|
||||
nInv.addItemStack(createItem(role, "Coop", new ItemStack(Material.NAME_TAG)), 15);
|
||||
nInv.addItemStack(createItem(role, "CoopPlayers", new ItemStack(Material.BOOK)), 16);
|
||||
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
|
||||
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
|
||||
21);
|
||||
nInv.addItemStack(createItem(role, "Border", new ItemStack(Material.BEACON)), 22);
|
||||
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
|
||||
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
|
||||
} else {
|
||||
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
|
||||
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 11);
|
||||
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 12);
|
||||
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 13);
|
||||
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 14);
|
||||
nInv.addItemStack(createItem(role, "Coop", new ItemStack(Material.NAME_TAG)), 15);
|
||||
nInv.addItemStack(createItem(role, "CoopPlayers", new ItemStack(Material.BOOK)), 16);
|
||||
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
|
||||
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
|
||||
21);
|
||||
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
|
||||
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
|
||||
}
|
||||
|
||||
nInv.setRows(3);
|
||||
} else {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
|
||||
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
|
||||
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 11);
|
||||
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 12);
|
||||
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 13);
|
||||
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 14);
|
||||
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 15);
|
||||
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
|
||||
16);
|
||||
nInv.addItemStack(createItem(role, "Border", new ItemStack(Material.BEACON)), 21);
|
||||
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 22);
|
||||
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 23);
|
||||
|
||||
nInv.setRows(3);
|
||||
} else {
|
||||
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
|
||||
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 10);
|
||||
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 11);
|
||||
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 12);
|
||||
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 13);
|
||||
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 14);
|
||||
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
|
||||
15);
|
||||
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 16);
|
||||
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 17);
|
||||
|
||||
nInv.setRows(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (role == IslandRole.Owner) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.PvP.Enable")) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.KeepItemsOnDeath.Enable")) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 13);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 14);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 15);
|
||||
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
|
||||
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 17);
|
||||
} else {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 16);
|
||||
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 17);
|
||||
}
|
||||
} else {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 16);
|
||||
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 17);
|
||||
} else {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 13);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 16);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
|
||||
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
|
||||
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 17);
|
||||
} else {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 13);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
|
||||
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
|
||||
}
|
||||
} else {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 13);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
|
||||
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 16);
|
||||
} else {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 14);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 15);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.KeepItemsOnDeath.Enable")) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 11);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 12);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 14);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 15);
|
||||
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
|
||||
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 17);
|
||||
} else {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 13);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 14);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 15);
|
||||
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
|
||||
}
|
||||
} else {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 13);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 14);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 15);
|
||||
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 16);
|
||||
} else {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 16);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 13);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 14);
|
||||
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 15);
|
||||
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 16);
|
||||
} else {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
|
||||
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
|
||||
}
|
||||
} else {
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
10);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
|
||||
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 16);
|
||||
} else {
|
||||
nInv.addItemStack(
|
||||
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
|
||||
11);
|
||||
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
|
||||
12);
|
||||
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 13);
|
||||
nInv.addItemStack(
|
||||
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
|
||||
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nInv.setRows(2);
|
||||
}
|
||||
|
||||
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
|
||||
configLoad.getString("Menu.Admin.Settings." + role.name() + ".Item.Return.Displayname"), null, null,
|
||||
null, null), 0, 8);
|
||||
nInv.setTitle(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings." + role.name() + ".Title")));
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> nInv.open());
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack createItem(IslandRole role, String setting, ItemStack is) {
|
||||
SkyBlock skyblock = SkyBlock.getInstance();
|
||||
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
List<String> itemLore = new ArrayList<>();
|
||||
|
||||
ItemMeta im = is.getItemMeta();
|
||||
|
||||
String roleName = role.name();
|
||||
|
||||
if (role == IslandRole.Visitor
|
||||
|| role == IslandRole.Member
|
||||
|| role == IslandRole.Coop) {
|
||||
roleName = "Default";
|
||||
}
|
||||
|
||||
im.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
||||
configLoad.getString("Menu.Admin.Settings." + roleName + ".Item.Setting." + setting + ".Displayname")));
|
||||
|
||||
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "settings.yml")).getFileConfiguration()
|
||||
.getBoolean("Settings." + role.name() + "." + setting)) {
|
||||
for (String itemLoreList : configLoad
|
||||
.getStringList("Menu.Admin.Settings." + roleName + ".Item.Setting.Status.Enabled.Lore")) {
|
||||
itemLore.add(ChatColor.translateAlternateColorCodes('&', itemLoreList));
|
||||
}
|
||||
} else {
|
||||
for (String itemLoreList : configLoad
|
||||
.getStringList("Menu.Admin.Settings." + roleName + ".Item.Setting.Status.Disabled.Lore")) {
|
||||
itemLore.add(ChatColor.translateAlternateColorCodes('&', itemLoreList));
|
||||
}
|
||||
}
|
||||
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
im.setLore(itemLore);
|
||||
is.setItemMeta(im);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
private String getRoleName(IslandRole role) {
|
||||
if (role == IslandRole.Visitor
|
||||
|| role == IslandRole.Member
|
||||
|| role == IslandRole.Coop) {
|
||||
return "Default";
|
||||
}
|
||||
|
||||
return role.name();
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
|
||||
Categories, Panel, Role
|
||||
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -28,6 +29,10 @@ public abstract class BasicPermission {
|
||||
}
|
||||
|
||||
public ItemStack getItem(Island island, IslandRole role) {
|
||||
return getItem(island.hasPermission(role, this), role);
|
||||
}
|
||||
|
||||
public ItemStack getItem(boolean permissionEnabled, IslandRole role) {
|
||||
ItemStack is = icon.getItem();
|
||||
FileManager.Config config = SkyBlock.getInstance().getFileManager()
|
||||
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml"));
|
||||
@ -44,18 +49,19 @@ public abstract class BasicPermission {
|
||||
|| role == IslandRole.Coop)
|
||||
roleName = "Default";
|
||||
|
||||
String nameFinal = configLoad.getString("Menu.Settings." + roleName + ".Item.Setting." + name + ".Displayname");
|
||||
String nameFinal = TextUtils.formatText(configLoad.getString("Menu.Settings." + roleName + ".Item.Setting." + name + ".Displayname", name));
|
||||
|
||||
im.setDisplayName(TextUtils.formatText(nameFinal == null ? name : nameFinal));
|
||||
if(im != null){
|
||||
im.setDisplayName(nameFinal);
|
||||
for (String itemLoreList : configLoad
|
||||
.getStringList("Menu.Settings." + roleName + ".Item.Setting.Status."
|
||||
+ (permissionEnabled ? "Enabled" : "Disabled") + ".Lore"))
|
||||
itemLore.add(TextUtils.formatText(itemLoreList));
|
||||
|
||||
for (String itemLoreList : configLoad
|
||||
.getStringList("Menu.Settings." + roleName + ".Item.Setting.Status."
|
||||
+ (island.hasPermission(role, this) ? "Enabled" : "Disabled") + ".Lore"))
|
||||
itemLore.add(TextUtils.formatText(itemLoreList));
|
||||
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
im.setLore(itemLore);
|
||||
is.setItemMeta(im);
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
im.setLore(itemLore);
|
||||
is.setItemMeta(im);
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.songoda.skyblock.permission;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.permission.event.Stoppable;
|
||||
@ -8,10 +9,13 @@ import com.songoda.skyblock.permission.permissions.basic.*;
|
||||
import com.songoda.skyblock.permission.permissions.listening.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
@ -111,7 +115,43 @@ public class PermissionManager {
|
||||
})).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void updateSettingsConfig(BasicPermission permission){
|
||||
FileManager.Config settingsConfig = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "settings.yml"));
|
||||
FileConfiguration settingsConfigLoad = settingsConfig.getFileConfiguration();
|
||||
|
||||
switch (permission.getType()){
|
||||
case GENERIC:
|
||||
if(settingsConfigLoad.getString("Settings.Visitor." + permission.getName()) == null){
|
||||
settingsConfigLoad.set("Settings.Visitor." + permission.getName(), true);
|
||||
}
|
||||
if(settingsConfigLoad.getString("Settings.Member." + permission.getName()) == null){
|
||||
settingsConfigLoad.set("Settings.Member." + permission.getName(), true);
|
||||
}
|
||||
if(settingsConfigLoad.getString("Settings.Coop." + permission.getName()) == null){
|
||||
settingsConfigLoad.set("Settings.Coop." + permission.getName(), true);
|
||||
}
|
||||
break;
|
||||
case OPERATOR:
|
||||
if(settingsConfigLoad.getString("Settings.Operator." + permission.getName()) == null){
|
||||
settingsConfigLoad.set("Settings.Operator." + permission.getName(), true);
|
||||
}
|
||||
break;
|
||||
case ISLAND:
|
||||
if(settingsConfigLoad.getString("Settings.Owner." + permission.getName()) == null){
|
||||
settingsConfigLoad.set("Settings.Owner." + permission.getName(), true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
try {
|
||||
settingsConfigLoad.save(settingsConfig.getFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean registerPermission(BasicPermission permission) {
|
||||
updateSettingsConfig(permission);
|
||||
|
||||
registeredPermissions.put(permission.getName().toUpperCase(), permission);
|
||||
Set<Method> methods;
|
||||
try {
|
||||
@ -146,6 +186,10 @@ public class PermissionManager {
|
||||
}
|
||||
|
||||
public boolean processPermission(Cancellable cancellable, Player player, Island island) {
|
||||
return processPermission(cancellable, player, island, false);
|
||||
}
|
||||
|
||||
public boolean processPermission(Cancellable cancellable, Player player, Island island, boolean reversePermission) {
|
||||
if (island == null) return true;
|
||||
|
||||
for (HandlerWrapper wrapper : registeredHandlers) {
|
||||
@ -157,7 +201,7 @@ public class PermissionManager {
|
||||
|
||||
BasicPermission permission = wrapper.getPermission();
|
||||
|
||||
if (hasPermission(player, island, permission))
|
||||
if (hasPermission(player, island, permission, reversePermission))
|
||||
continue;
|
||||
|
||||
try {
|
||||
@ -166,23 +210,40 @@ public class PermissionManager {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return !cancellable.isCancelled();
|
||||
}
|
||||
|
||||
public boolean hasPermission(Player player, Island island, BasicPermission permission) {
|
||||
public boolean hasPermission(Player player, Island island, BasicPermission permission, boolean reversePermission){
|
||||
if (player == null)
|
||||
return island.hasPermission(IslandRole.Owner, permission);
|
||||
|
||||
if (player.hasPermission("fabledskyblock.bypass." + permission.getName().toLowerCase()))
|
||||
return true;
|
||||
return !reversePermission;
|
||||
|
||||
if (island.hasPermission(island.getRole(player), permission))
|
||||
return true;
|
||||
FileManager.Config config = SkyBlock.getInstance().getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (island.isCoopPlayer(player.getUniqueId()) && island.hasPermission(IslandRole.Coop, permission))
|
||||
return true;
|
||||
switch(island.getRole(player)){
|
||||
case Owner:
|
||||
if(!configLoad.getBoolean("Island.Settings.OwnersAndOperatorsAsMembers", false)){
|
||||
return island.hasPermission(IslandRole.Owner, permission);
|
||||
}
|
||||
case Operator:
|
||||
if(!configLoad.getBoolean("Island.Settings.OwnersAndOperatorsAsMembers", false)){
|
||||
return island.hasPermission(IslandRole.Operator, permission);
|
||||
}
|
||||
case Member:
|
||||
return island.hasPermission(IslandRole.Member, permission);
|
||||
case Coop:
|
||||
return island.hasPermission(IslandRole.Coop, permission);
|
||||
case Visitor:
|
||||
return island.hasPermission(IslandRole.Visitor, permission);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return island.hasPermission(IslandRole.Visitor, permission);
|
||||
public boolean hasPermission(Player player, Island island, BasicPermission permission) {
|
||||
return this.hasPermission(player, island, permission, false);
|
||||
}
|
||||
|
||||
public boolean hasPermission(Location location, String permission, IslandRole islandRole) {
|
||||
|
@ -7,6 +7,7 @@ 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.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -52,10 +53,10 @@ public class DamagePermission extends ListeningPermission {
|
||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getBoolean("Island.Settings.Damage.Enable"))
|
||||
event.setCancelled(true);
|
||||
else if (!configLoad.getBoolean("Island.Damage.Enable"))
|
||||
if (configLoad.getBoolean("Island.Settings.Damage.Enable", false)
|
||||
|| !configLoad.getBoolean("Island.Damage.Enable", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@PermissionHandler
|
||||
@ -67,9 +68,8 @@ public class DamagePermission extends ListeningPermission {
|
||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getBoolean("Island.Settings.Damage.Enable")) {
|
||||
event.setCancelled(true);
|
||||
} else if (!configLoad.getBoolean("Island.Damage.Enable")) {
|
||||
if (configLoad.getBoolean("Island.Settings.Damage.Enable", false)
|
||||
|| !configLoad.getBoolean("Island.Damage.Enable", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,8 @@ 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 org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
@ -27,8 +26,6 @@ public class DestroyPermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
@ -42,13 +39,24 @@ 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();
|
||||
Player player = null;
|
||||
if (event.getDamager() instanceof Player) {
|
||||
player = (Player) event.getDamager();
|
||||
}
|
||||
if(event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof Player){
|
||||
player = (Player) ((Projectile) event.getDamager()).getShooter();
|
||||
}
|
||||
if(player != null){
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (entity.getType() != EntityType.ARMOR_STAND) return;
|
||||
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
switch (entity.getType()){
|
||||
case ARMOR_STAND:
|
||||
case PAINTING:
|
||||
case ITEM_FRAME:
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@PermissionHandler
|
||||
|
@ -81,7 +81,7 @@ public class ExplosionsPermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onTNTInteract(PlayerInteractEvent event) {
|
||||
if(event.getItem().getType().equals(CompatibleMaterial.FLINT_AND_STEEL.getMaterial())
|
||||
if(event.getItem() != null && event.getItem().getType().equals(CompatibleMaterial.FLINT_AND_STEEL.getMaterial())
|
||||
&& event.getClickedBlock().getType().equals(CompatibleMaterial.TNT.getBlockMaterial())){
|
||||
cancelAndMessage(event, event.getPlayer(), plugin, plugin.getMessageManager());
|
||||
}
|
||||
|
@ -24,18 +24,18 @@ public class MobHurtingPermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onVehicleDamage(VehicleDamageEvent event) {
|
||||
|
||||
|
||||
Player player = (Player) event.getAttacker();
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
if(event.getAttacker() instanceof Player){
|
||||
Player player = (Player) event.getAttacker();
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
}
|
||||
}
|
||||
|
||||
@PermissionHandler
|
||||
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
||||
|
||||
|
||||
Player player = (Player) event.getAttacker();
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
if(event.getAttacker() instanceof Player){
|
||||
Player player = (Player) event.getAttacker();
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
}
|
||||
}
|
||||
|
||||
@PermissionHandler
|
||||
|
@ -3,12 +3,16 @@ 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.island.*;
|
||||
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.world.LocationUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
@ -26,29 +30,55 @@ public class PortalPermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onPortalEnter(PlayerEnterPortalEvent event) {
|
||||
Player player = (Player) event.getEntity();
|
||||
if(event.getEntity() instanceof Player){
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
}
|
||||
|
||||
@PermissionHandler
|
||||
public void onMove(PlayerMoveEvent event) {
|
||||
CompatibleMaterial toMaterial = CompatibleMaterial.getMaterial(event.getTo().getBlock().getType());
|
||||
|
||||
if (toMaterial == CompatibleMaterial.NETHER_BRICK || toMaterial == CompatibleMaterial.END_PORTAL) {
|
||||
event.setTo(LocationUtil.getRandomLocation(event.getFrom().getWorld(), 5000, 5000, true, true));
|
||||
cancelAndMessage(event, event.getPlayer(), plugin, messageManager);
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
}
|
||||
}
|
||||
|
||||
@PermissionHandler
|
||||
public void onMove(PlayerMoveEvent event) {
|
||||
if(event.getTo() != null){
|
||||
CompatibleMaterial toMaterial = CompatibleMaterial.getMaterial(event.getTo().getBlock().getType());
|
||||
|
||||
if (toMaterial == CompatibleMaterial.NETHER_PORTAL || toMaterial == CompatibleMaterial.END_PORTAL) {
|
||||
//event.setTo(LocationUtil.getRandomLocation(event.getFrom().getWorld(), 5000, 5000, true, true));
|
||||
cancelAndMessage(event, event.getPlayer(), plugin, messageManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PermissionHandler
|
||||
public void onTeleport(PlayerTeleportEvent event) {
|
||||
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)
|
||||
if (event.getCause().equals(PlayerTeleportEvent.TeleportCause.ENDER_PEARL)
|
||||
|| event.getCause().equals(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL)
|
||||
|| event.getCause().equals(PlayerTeleportEvent.TeleportCause.END_PORTAL)
|
||||
|| (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)
|
||||
&& event.getCause().equals(PlayerTeleportEvent.TeleportCause.END_GATEWAY))){
|
||||
/*event.getPlayer().teleport(getToLocation(event.getFrom(), event.getPlayer()));
|
||||
Location to = getToLocation(event.getFrom(), event.getPlayer());
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
event.getPlayer().teleport(to);
|
||||
});
|
||||
event.setTo(to);*/
|
||||
|
||||
cancelAndMessage(event, event.getPlayer(), plugin, messageManager);
|
||||
}
|
||||
}
|
||||
|
||||
private Location getToLocation(Location from, Player player) {
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
Island island = islandManager.getIslandAtLocation(from);
|
||||
Location to = island.getLocation(IslandWorld.Normal, IslandEnvironment.Main);
|
||||
if(island.hasRole(IslandRole.Visitor, player.getUniqueId())){
|
||||
to = LocationUtil.getSafeLocation(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
|
||||
if(to == null){
|
||||
to = LocationUtil.getSpawnLocation();
|
||||
}
|
||||
}
|
||||
return to;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,8 @@ import com.songoda.skyblock.permission.ListeningPermission;
|
||||
import com.songoda.skyblock.permission.PermissionHandler;
|
||||
import com.songoda.skyblock.permission.PermissionType;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
|
||||
import java.io.File;
|
||||
@ -28,26 +29,24 @@ public class PvpPermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
Player player;
|
||||
if (event.getDamager() instanceof Player)
|
||||
player = (Player) event.getDamager();
|
||||
else if (event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof Player)
|
||||
player = (Player) ((Projectile) event.getDamager()).getShooter();
|
||||
else return;
|
||||
|
||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getBoolean("Island.Settings.PvP.Enable")) {
|
||||
event.setCancelled(true);
|
||||
} else if (!configLoad.getBoolean("Island.PvP.Enable")) {
|
||||
event.setCancelled(true);
|
||||
Player attacker = null;
|
||||
if (event.getDamager() instanceof Player) {
|
||||
attacker = (Player) event.getDamager();
|
||||
} else if (event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof Player) {
|
||||
attacker = (Player) ((Projectile) event.getDamager()).getShooter();
|
||||
}
|
||||
|
||||
if (entity.getType() == EntityType.ARMOR_STAND || !(entity instanceof Monster)) return;
|
||||
if(attacker != null && event.getEntity() instanceof Player){
|
||||
|
||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getBoolean("Island.Settings.PvP.Enable") || !configLoad.getBoolean("Island.PvP.Enable")) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
cancelAndMessage(event, attacker, plugin, messageManager);
|
||||
}
|
||||
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ 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 org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.minecart.StorageMinecart;
|
||||
@ -27,31 +28,44 @@ public class StoragePermission extends ListeningPermission {
|
||||
|
||||
@PermissionHandler
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK))
|
||||
return;
|
||||
|
||||
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock());
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (material == CompatibleMaterial.CHEST || material == CompatibleMaterial.TRAPPED_CHEST
|
||||
|| (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
|
||||
|| material == CompatibleMaterial.LIGHT_BLUE_SHULKER_BOX || material == CompatibleMaterial.LIGHT_GRAY_SHULKER_BOX
|
||||
|| 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))
|
||||
|| ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14) && material == CompatibleMaterial.BARREL)
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
switch (material){
|
||||
case CHEST:
|
||||
case TRAPPED_CHEST:
|
||||
case DROPPER:
|
||||
case DISPENSER:
|
||||
case SHULKER_BOX:
|
||||
case BLACK_SHULKER_BOX:
|
||||
case BLUE_SHULKER_BOX:
|
||||
case BROWN_SHULKER_BOX:
|
||||
case CYAN_SHULKER_BOX:
|
||||
case GRAY_SHULKER_BOX:
|
||||
case GREEN_SHULKER_BOX:
|
||||
case LIGHT_BLUE_SHULKER_BOX:
|
||||
case LIGHT_GRAY_SHULKER_BOX:
|
||||
case LIME_SHULKER_BOX:
|
||||
case MAGENTA_SHULKER_BOX:
|
||||
case ORANGE_SHULKER_BOX:
|
||||
case PURPLE_SHULKER_BOX:
|
||||
case PINK_SHULKER_BOX:
|
||||
case RED_SHULKER_BOX:
|
||||
case YELLOW_SHULKER_BOX:
|
||||
case WHITE_SHULKER_BOX:
|
||||
case BARREL:
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
}
|
||||
}
|
||||
|
||||
@PermissionHandler
|
||||
public void onInteractEntity(PlayerInteractEntityEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (event.getRightClicked().getType() == EntityType.ITEM_FRAME
|
||||
if (event.getRightClicked().getType().equals(EntityType.ITEM_FRAME)
|
||||
|| event.getRightClicked() instanceof StorageMinecart)
|
||||
cancelAndMessage(event, player, plugin, messageManager);
|
||||
|
||||
|
@ -255,7 +255,7 @@ public class PlayerData {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
transactions = BankManager.getInstance().getTransactionList(getPlayer());
|
||||
transactions = BankManager.getInstance().getTransactionList(getPlayerUUID());
|
||||
Config config = getConfig();
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
configLoad.set("Statistics.Island.Playtime", getPlaytime());
|
||||
@ -287,6 +287,10 @@ public class PlayerData {
|
||||
return Bukkit.getPlayer(uuid);
|
||||
}
|
||||
|
||||
public UUID getPlayerUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public List<Transaction> getTransactions() {
|
||||
return transactions;
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
package com.songoda.skyblock.scoreboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -118,9 +114,9 @@ public class Scoreboard {
|
||||
|
||||
if (displayLine.length() >= 16) {
|
||||
String prefixLine = displayLine.substring(0, Math.min(displayLine.length(), 16));
|
||||
String suffixLine = displayLine.substring(16, Math.min(displayLine.length(), displayLine.length()));
|
||||
String suffixLine = displayLine.substring(16);
|
||||
|
||||
if (prefixLine.substring(prefixLine.length() - 1).equals("&")) {
|
||||
if (prefixLine.endsWith("&")) {
|
||||
prefixLine = ChatColor.translateAlternateColorCodes('&', prefixLine.substring(0, prefixLine.length() - 1));
|
||||
suffixLine = ChatColor.translateAlternateColorCodes('&', "&" + suffixLine);
|
||||
} else {
|
||||
@ -175,7 +171,8 @@ public class Scoreboard {
|
||||
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
|
||||
displayLine = displayLine.replace("%players_online", "" + Bukkit.getServer().getOnlinePlayers().size()).replace("%players_max", "" + Bukkit.getServer().getMaxPlayers());
|
||||
displayLine = displayLine.replace("%players_online", String.valueOf(Bukkit.getServer().getOnlinePlayers().size()));
|
||||
displayLine = displayLine.replace("%players_max", String.valueOf(Bukkit.getServer().getMaxPlayers()));
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
|
||||
@ -212,9 +209,9 @@ public class Scoreboard {
|
||||
PlaceholderManager placeholderManager = skyblock.getPlaceholderManager();
|
||||
|
||||
if (placeholderManager.isPlaceholderAPIEnabled()) {
|
||||
displayLine = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, displayLine.replace("&", "clr")).replace("clr", "&");
|
||||
displayLine = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, displayLine);
|
||||
}
|
||||
|
||||
return displayLine;
|
||||
return displayLine.replace("§", "&"); // Returning unformatted line to avoid issues in next step
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,13 @@ public class Stackable {
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void take(int n) {
|
||||
this.size-=n;
|
||||
this.updateDisplay();
|
||||
SkyBlock.getInstance().getSoundManager().playSound(this.location, CompatibleSound.ENTITY_ARROW_HIT.getSound(), 1.0F, 1.0F);
|
||||
this.save();
|
||||
}
|
||||
|
||||
public boolean isMaxSize(){
|
||||
return size > maxSize;
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -38,29 +40,32 @@ public final class LocationUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static Location getSafeLocation(Location loc){
|
||||
public static @Nullable Location getSafeLocation(Location loc){
|
||||
boolean found = false;
|
||||
Location locChecked = loc.clone();
|
||||
loc.getWorld().loadChunk(loc.getWorld().getChunkAt(loc));
|
||||
for(int i=loc.getBlockY(); i>=0 && !found; i--){
|
||||
locChecked = locChecked.subtract(0d, 1d, 0d);
|
||||
found = checkBlock(locChecked);
|
||||
}
|
||||
if(!found){
|
||||
for(int i=loc.getBlockY(); i<256 && !found; i++){
|
||||
locChecked = locChecked.add(0d, 1d, 0d);
|
||||
Location locChecked = null;
|
||||
if(loc != null && loc.getWorld() != null){
|
||||
locChecked = loc.clone();
|
||||
loc.getWorld().loadChunk(loc.getWorld().getChunkAt(loc));
|
||||
for(int i=loc.getBlockY(); i>=0 && !found; i--){
|
||||
locChecked = locChecked.subtract(0d, 1d, 0d);
|
||||
found = checkBlock(locChecked);
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
locChecked = locChecked.add(0d,1d,0d);
|
||||
} else {
|
||||
locChecked = null;
|
||||
if(!found){
|
||||
for(int i=loc.getBlockY(); i<256 && !found; i++){
|
||||
locChecked = locChecked.add(0d, 1d, 0d);
|
||||
found = checkBlock(locChecked);
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
locChecked = locChecked.add(0d,1d,0d);
|
||||
} else {
|
||||
locChecked = null;
|
||||
}
|
||||
}
|
||||
return locChecked;
|
||||
}
|
||||
|
||||
public static Location getDefinitiveLocation(Location loc){
|
||||
public static @Nonnull Location getDefinitiveLocation(Location loc){
|
||||
Location locWorking = loc.clone();
|
||||
for(int i=locWorking.getBlockY(); i>=0; i--){
|
||||
if(!locWorking.getBlock().isEmpty()){
|
||||
|
@ -1683,14 +1683,11 @@ challenges:
|
||||
- 'NEAR:COW 1'
|
||||
- 'NEAR:RABBIT 1'
|
||||
- 'NEAR:WOLF 1'
|
||||
- 'NEAR:DONKEY 1'
|
||||
- 'NEAR:HORSE 1'
|
||||
- 'NEAR:LLAMA 1'
|
||||
- 'NEAR:OCELOT 1'
|
||||
- 'NEAR:MUSHROOM_COW 1'
|
||||
- 'NEAR:SHEEP 1'
|
||||
- 'NEAR:VILLAGER 1'
|
||||
- 'NEAR:SKELETON_HORSE 1'
|
||||
reward:
|
||||
- 'CMD:eco give {player} 3000'
|
||||
- 'ITEM:diamond_block 32'
|
||||
@ -1709,14 +1706,11 @@ challenges:
|
||||
- '&e - 1 Cow'
|
||||
- '&e - 1 Rabbit'
|
||||
- '&e - 1 Wolf'
|
||||
- '&e - 1 Donkey'
|
||||
- '&e - 1 Horse'
|
||||
- '&e - 1 Llama'
|
||||
- '&e - 1 Ocelot'
|
||||
- '&e - 1 Mooshroom cow'
|
||||
- '&e - 1 Sheep'
|
||||
- '&e - 1 Villager'
|
||||
- '&e - 1 Skeleton Horse'
|
||||
- '&c&lRewards:'
|
||||
- '&e- 32 diamond blocks'
|
||||
- '&e- 3000 $'
|
||||
|
@ -36,7 +36,7 @@ Island:
|
||||
Time: 60
|
||||
# [!] How many seconds to wait before teleporting to a newly created island
|
||||
TeleportTimeout: 1
|
||||
# The distance between the islands
|
||||
# The distance between the islands EXPERIMENTAL!
|
||||
Distance: 1200
|
||||
Deletion:
|
||||
# [!] You are adviced to keep these options both enabled to prevent any issues.
|
||||
@ -209,7 +209,7 @@ Island:
|
||||
# Island Level Points divided by value
|
||||
Division: 100
|
||||
# Points to subtract to Island Level Points
|
||||
Subtract: 1000
|
||||
Subtract: 0
|
||||
Cooldown:
|
||||
# Time until Island level rescan expires
|
||||
Time: 60
|
||||
@ -299,6 +299,9 @@ Island:
|
||||
Enable: true
|
||||
Hunger:
|
||||
Enable: false
|
||||
# If owners and operators should have same permission of members
|
||||
# It should be left to false as it could be changed soon
|
||||
OwnersAndOperatorsAsMembers: false
|
||||
Portal:
|
||||
# When disabled, when a player enters a portal, they will teleport to the nether or
|
||||
# end world rather than the island world.
|
||||
|
@ -1145,6 +1145,18 @@ Menu:
|
||||
Displayname: '&aDoor Use'
|
||||
Jukebox:
|
||||
Displayname: '&aJukebox Use'
|
||||
PvP:
|
||||
Displayname: '&aPvP'
|
||||
Noteblock:
|
||||
Displayname: '&aNoteblock use'
|
||||
Minecart:
|
||||
Displayname: '&aMinecart'
|
||||
Damage:
|
||||
Displayname: '&aDamage'
|
||||
Boat:
|
||||
Displayname: '&aBoat'
|
||||
Trample:
|
||||
Displayname: '&aTrample'
|
||||
Bucket:
|
||||
Displayname: '&aBucket Use'
|
||||
SpawnEgg:
|
||||
@ -1502,6 +1514,18 @@ Menu:
|
||||
- '&7Status&8: &cfalse'
|
||||
Milking:
|
||||
Displayname: '&aMilking'
|
||||
PvP:
|
||||
Displayname: '&aPvP'
|
||||
Noteblock:
|
||||
Displayname: '&aNoteblock use'
|
||||
Minecart:
|
||||
Displayname: '&aMinecart'
|
||||
Damage:
|
||||
Displayname: '&aDamage'
|
||||
Boat:
|
||||
Displayname: '&aBoat'
|
||||
Trample:
|
||||
Displayname: '&aTrample'
|
||||
Anvil:
|
||||
Displayname: '&aAnvil Use'
|
||||
Portal:
|
||||
|
@ -5,7 +5,7 @@ api-version: 1.13
|
||||
description: A unique SkyBlock plugin
|
||||
author: Songoda
|
||||
authors: [Fabrimat]
|
||||
softdepend: [HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, LeaderHeads, EpicSpawners, WildStacker, UltimateStacker, WorldEdit]
|
||||
softdepend: [HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, LeaderHeads, EpicSpawners, WildStacker, UltimateStacker, WorldEdit, Residence]
|
||||
loadbefore: [Multiverse-Core, ProtocolLib]
|
||||
commands:
|
||||
island:
|
||||
|
@ -48,6 +48,7 @@ Settings:
|
||||
ExperienceOrbPickup: false
|
||||
Trapdoor: false
|
||||
Noteblock: false
|
||||
Damage: true
|
||||
Member:
|
||||
Destroy: true
|
||||
Place: true
|
||||
@ -97,6 +98,7 @@ Settings:
|
||||
ExperienceOrbPickup: true
|
||||
Trapdoor: true
|
||||
Noteblock: true
|
||||
Damage: true
|
||||
Operator:
|
||||
Invite: true
|
||||
Kick: true
|
||||
@ -158,13 +160,11 @@ Settings:
|
||||
Hopper: true
|
||||
EntityPlacement: true
|
||||
ExperienceOrbPickup: true
|
||||
Damage: true
|
||||
Owner:
|
||||
NaturalMobSpawning: true
|
||||
MobGriefing: false
|
||||
PvP: false
|
||||
Explosions: false
|
||||
FireSpread: true
|
||||
LeafDecay: true
|
||||
KeepItemsOnDeath: true
|
||||
Damage: true
|
||||
Hunger: true
|
||||
KeepItemsOnDeath: true
|
Loading…
Reference in New Issue
Block a user