Merge remote-tracking branch 'origin/master' into development

This commit is contained in:
Brianna 2020-06-15 14:47:22 -05:00
commit e3b93209f7
42 changed files with 1290 additions and 355 deletions

BIN
.DS_Store vendored

Binary file not shown.

16
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,16 @@
image: maven:latest
cache:
paths:
- .m2/repository/
- target/
build:
stage: build
script:
- mvn compile
test:
stage: test
script:
- mvn test

39
README.md Normal file
View File

@ -0,0 +1,39 @@
FabledSkyBlock LaborPatch
===========
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 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 water in Nether mechanics!
- Added option to let slime splitting bypass limits.yml
- Added option to define distance between islands
- Added option to clear inventory and/or enderchest on island delete (working only with online players)
- Added deletion cooldown
- 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
- Now you can use `/is chat <message>` to send messages to island chat
- Now Challenges can be per-island too
- Hide options in control panel if missing the permission
- Hide vanished players from visitors list
- Hide bank from leaderboard if disabled
- Minor bug fixes
- Little optimizations
Use this fork at your own risk. No support provided.
Compile
------
To compile this fork, clone it and run the following command
```
mvn clean package
```
You will find the jar file in the target/ directory.

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId> <artifactId>skyblock</artifactId>
<version>2.2.16</version> <version>2.2.16-LaborPatch-0.0.3</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>
<defaultGoal>clean install</defaultGoal> <defaultGoal>clean install</defaultGoal>

BIN
src/.DS_Store vendored

Binary file not shown.

View File

@ -39,6 +39,7 @@ import com.songoda.skyblock.scoreboard.ScoreboardManager;
import com.songoda.skyblock.sound.SoundManager; import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.stackable.StackableManager; import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.structure.StructureManager; import com.songoda.skyblock.structure.StructureManager;
import com.songoda.skyblock.tasks.MobNetherWaterTask;
import com.songoda.skyblock.upgrade.UpgradeManager; import com.songoda.skyblock.upgrade.UpgradeManager;
import com.songoda.skyblock.usercache.UserCacheManager; import com.songoda.skyblock.usercache.UserCacheManager;
import com.songoda.skyblock.visit.VisitManager; import com.songoda.skyblock.visit.VisitManager;
@ -80,6 +81,7 @@ public class SkyBlock extends SongodaPlugin {
private PlaceholderManager placeholderManager; private PlaceholderManager placeholderManager;
private MessageManager messageManager; private MessageManager messageManager;
private HologramTask hologramTask; private HologramTask hologramTask;
private MobNetherWaterTask mobNetherWaterTask;
private LimitationInstanceHandler limitationHandler; private LimitationInstanceHandler limitationHandler;
private LocalizationManager localizationManager; private LocalizationManager localizationManager;
private RewardManager rewardManager; private RewardManager rewardManager;
@ -161,6 +163,7 @@ public class SkyBlock extends SongodaPlugin {
// Start Tasks // Start Tasks
hologramTask = HologramTask.startTask(this); hologramTask = HologramTask.startTask(this);
mobNetherWaterTask = MobNetherWaterTask.startTask(this);
PluginManager pluginManager = getServer().getPluginManager(); PluginManager pluginManager = getServer().getPluginManager();
pluginManager.registerEvents(new Join(this), this); pluginManager.registerEvents(new Join(this), this);
@ -228,6 +231,10 @@ public class SkyBlock extends SongodaPlugin {
this.hologramTask.onDisable(); this.hologramTask.onDisable();
} }
if (this.mobNetherWaterTask != null) {
this.mobNetherWaterTask.onDisable();
}
if (this.fabledChallenge != null) { if (this.fabledChallenge != null) {
this.fabledChallenge.onDisable(); this.fabledChallenge.onDisable();
} }
@ -341,6 +348,10 @@ public class SkyBlock extends SongodaPlugin {
return hologramTask; return hologramTask;
} }
public MobNetherWaterTask getMobNetherWaterTask() {
return mobNetherWaterTask;
}
public StackableManager getStackableManager() { public StackableManager getStackableManager() {
return stackableManager; return stackableManager;
} }

View File

@ -78,37 +78,37 @@ public class Challenge {
} }
} }
} }
// GETTERS // GETTERS
public ChallengeCategory getCategory() { public ChallengeCategory getCategory() {
return category; return category;
} }
public int getId() { public int getId() {
return id; return id;
} }
public String getName() { public String getName() {
return name; return name;
} }
public int getMaxTimes() { public int getMaxTimes() {
return maxTimes; return maxTimes;
} }
public boolean isShowInChat() { public boolean isShowInChat() {
return showInChat; return showInChat;
} }
public List<Peer<Type, Object>> getRequires() { public List<Peer<Type, Object>> getRequires() {
return requires; return requires;
} }
public List<Peer<Type, Object>> getRewards() { public List<Peer<Type, Object>> getRewards() {
return rewards; return rewards;
} }
public ItemChallenge getItem() { public ItemChallenge getItem() {
return item; return item;
} }
@ -151,14 +151,31 @@ public class Challenge {
// Check if player has specific item in his inventory // Check if player has specific item in his inventory
ItemStack is = (ItemStack) obj; ItemStack is = (ItemStack) obj;
return p.getInventory().containsAtLeast(new ItemStack(is.getType()), is.getAmount()); return p.getInventory().containsAtLeast(new ItemStack(is.getType()), is.getAmount());
// return p.getInventory().contains(is.getType(), is.getAmount());
} }
@Override @Override
public void executeRequire(Player p, Object obj) { public void executeRequire(Player p, Object obj) {
// Remove specific item in player's inventory if(obj instanceof ItemStack){
ItemStack is = (ItemStack) obj; // Remove specific item in player's inventory
p.getInventory().removeItem(new ItemStack(is.getType(), is.getAmount())); ItemStack is = (ItemStack) obj;
//p.getInventory().removeItem(new ItemStack(is.getType(), is.getAmount()));
int toRemove = is.getAmount();
for(ItemStack jis : p.getInventory().getStorageContents()) {
if(jis != null && jis.isSimilar(is)) {
if(jis.getAmount() <= toRemove) {
toRemove -= jis.getAmount();
jis.setAmount(0);
} else {
jis.setAmount(jis.getAmount() - toRemove);
toRemove = 0;
}
}
if(toRemove <= 0) {
p.updateInventory();
break;
}
}
}
// TODO LOG // TODO LOG
} }
@ -422,7 +439,7 @@ public class Challenge {
* <li>7 = lingering extended</li> * <li>7 = lingering extended</li>
* <li>8 = lingering ++</li> * <li>8 = lingering ++</li>
* </ul> * </ul>
* *
* @param is * @param is
* @param type * @param type
* @param data * @param data
@ -451,7 +468,7 @@ public class Challenge {
/** /**
* Try to convert the value to a useable object used later * Try to convert the value to a useable object used later
* *
* @param value * @param value
* The value to convert * The value to convert
* @return A useable object required * @return A useable object required
@ -460,7 +477,7 @@ public class Challenge {
/** /**
* Check if specific player has requirement for specific object * Check if specific player has requirement for specific object
* *
* @param p * @param p
* The player * The player
* @param obj * @param obj
@ -471,7 +488,7 @@ public class Challenge {
/** /**
* Execute an action associated with specific object for specific player * Execute an action associated with specific object for specific player
* *
* @param p * @param p
* The player * The player
* @param obj * @param obj
@ -481,7 +498,7 @@ public class Challenge {
/** /**
* Give a reward to specific player for specific object * Give a reward to specific player for specific object
* *
* @param p * @param p
* The player * The player
* @param obj * @param obj

View File

@ -10,6 +10,7 @@ import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.songoda.skyblock.challenge.FabledChallenge; import com.songoda.skyblock.challenge.FabledChallenge;
@ -21,6 +22,7 @@ import com.songoda.skyblock.challenge.defaultinv.Item;
import com.songoda.skyblock.challenge.inventory.ClickableItem; import com.songoda.skyblock.challenge.inventory.ClickableItem;
import com.songoda.skyblock.challenge.inventory.Inventory; import com.songoda.skyblock.challenge.inventory.Inventory;
import com.songoda.skyblock.challenge.inventory.InventoryProvider; import com.songoda.skyblock.challenge.inventory.InventoryProvider;
import org.bukkit.inventory.meta.ItemMeta;
public class ChallengeInventory implements InventoryProvider { public class ChallengeInventory implements InventoryProvider {
public static final String CATEGORY = "ChallengeCategory"; public static final String CATEGORY = "ChallengeCategory";
@ -78,6 +80,10 @@ public class ChallengeInventory implements InventoryProvider {
// If challenge is done, add enchantment to show to player that it's done // If challenge is done, add enchantment to show to player that it's done
if (count >= c.getMaxTimes()) if (count >= c.getMaxTimes())
is.addUnsafeEnchantment(Enchantment.OXYGEN, 1); is.addUnsafeEnchantment(Enchantment.OXYGEN, 1);
ItemMeta im = is.getItemMeta();
im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
is.setItemMeta(im);
Consumer<InventoryClickEvent> consumer = e -> { Consumer<InventoryClickEvent> consumer = e -> {
// Count the new value // Count the new value
int count2 = done.getOrDefault(c, 0); int count2 = done.getOrDefault(c, 0);
@ -97,6 +103,9 @@ public class ChallengeInventory implements InventoryProvider {
// If challenge is done, add enchantment to show to player that it's done // If challenge is done, add enchantment to show to player that it's done
if (count2 >= c.getMaxTimes()) if (count2 >= c.getMaxTimes())
is2.addUnsafeEnchantment(Enchantment.OXYGEN, 1); is2.addUnsafeEnchantment(Enchantment.OXYGEN, 1);
ItemMeta im2 = is2.getItemMeta();
im2.addItemFlags(ItemFlag.HIDE_ENCHANTS);
is2.setItemMeta(im2);
// Update // Update
inv.updateItem(ic.getCol(), ic.getRow(), is2); inv.updateItem(ic.getCol(), ic.getRow(), is2);
} else } else

View File

@ -7,6 +7,7 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import com.songoda.skyblock.island.Island;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
@ -22,19 +23,32 @@ import com.songoda.skyblock.config.FileManager.Config;
public class PlayerManager { public class PlayerManager {
private SkyBlock skyblock; private SkyBlock skyblock;
private HashMap<UUID, HashMap<Challenge, Integer>> players; private HashMap<UUID, HashMap<Challenge, Integer>> islands;
private File playersDirectory; private File playersDirectory;
public PlayerManager(SkyBlock skyblock) { public PlayerManager(SkyBlock skyblock) {
this.skyblock = skyblock; this.skyblock = skyblock;
players = new HashMap<>(); islands = new HashMap<>();
playersDirectory = new File(skyblock.getDataFolder(), "challenge-data"); playersDirectory = new File(skyblock.getDataFolder(), "challenge-data");
if (!playersDirectory.exists()) if (!playersDirectory.exists())
playersDirectory.mkdirs(); playersDirectory.mkdirs();
Bukkit.getScheduler().runTask(skyblock, () -> {
for(Player p : Bukkit.getServer().getOnlinePlayers()){
loadPlayer(p.getUniqueId());
}
});
} }
public HashMap<Challenge, Integer> getPlayer(UUID uuid) { public HashMap<Challenge, Integer> getPlayer(UUID uuid) {
return players.get(uuid); if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
uuid = is.getOwnerUUID();
}
}
return islands.get(uuid);
} }
/** /**
@ -44,7 +58,15 @@ public class PlayerManager {
* The uuid of specific player * The uuid of specific player
*/ */
public void loadPlayer(UUID uuid) { public void loadPlayer(UUID uuid) {
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory, uuid.toString() + ".yml")); if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
uuid = is.getOwnerUUID();
}
}
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory,
uuid.toString() + ".yml"));
FileConfiguration fileConfig = config.getFileConfiguration(); FileConfiguration fileConfig = config.getFileConfiguration();
HashMap<Challenge, Integer> challenges = new HashMap<>(); HashMap<Challenge, Integer> challenges = new HashMap<>();
ConfigurationSection section = fileConfig.getConfigurationSection("challenges"); ConfigurationSection section = fileConfig.getConfigurationSection("challenges");
@ -67,7 +89,7 @@ public class PlayerManager {
challenges.put(c, count); challenges.put(c, count);
} }
} }
players.put(uuid, challenges); islands.put(uuid, challenges);
} }
/** /**
@ -77,8 +99,16 @@ public class PlayerManager {
* The uuid of specific player * The uuid of specific player
*/ */
public void unloadPlayer(UUID uuid) { public void unloadPlayer(UUID uuid) {
players.remove(uuid); if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
skyblock.getFileManager().unloadConfig(new File(playersDirectory, uuid.toString() + ".yml")); .getBoolean("Island.Challenge.PerIsland", true)) {
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
uuid = is.getOwnerUUID();
}
}
islands.remove(uuid);
skyblock.getFileManager().unloadConfig(new File(playersDirectory,
uuid.toString() + ".yml"));
} }
@ -95,11 +125,18 @@ public class PlayerManager {
if (c == null) if (c == null)
return false; return false;
UUID uuid = p.getUniqueId(); UUID uuid = p.getUniqueId();
HashMap<Challenge, Integer> done = players.get(uuid); if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
uuid = is.getOwnerUUID();
}
}
HashMap<Challenge, Integer> done = islands.get(uuid);
if (done == null) { if (done == null) {
// Wtf ? // Wtf ?
loadPlayer(uuid); loadPlayer(uuid);
done = players.get(uuid); done = islands.get(uuid);
} }
int count = done.getOrDefault(c, 0); int count = done.getOrDefault(c, 0);
if (c.getMaxTimes() != 0 && count >= c.getMaxTimes()) if (c.getMaxTimes() != 0 && count >= c.getMaxTimes())
@ -124,7 +161,14 @@ public class PlayerManager {
if (!canDoChallenge(p, c)) if (!canDoChallenge(p, c))
return false; return false;
UUID uuid = p.getUniqueId(); UUID uuid = p.getUniqueId();
HashMap<Challenge, Integer> done = players.get(uuid); if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
uuid = is.getOwnerUUID();
}
}
HashMap<Challenge, Integer> done = islands.get(uuid);
int count = done.getOrDefault(c, 0); int count = done.getOrDefault(c, 0);
done.put(c, count + 1); done.put(c, count + 1);
addChallenge(uuid, c); addChallenge(uuid, c);
@ -146,7 +190,15 @@ public class PlayerManager {
} }
public void addChallenge(UUID uuid, Challenge c) { public void addChallenge(UUID uuid, Challenge c) {
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory, uuid.toString() + ".yml")); if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
uuid = is.getOwnerUUID();
}
}
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory,
uuid.toString() + ".yml"));
FileConfiguration fileConfig = config.getFileConfiguration(); FileConfiguration fileConfig = config.getFileConfiguration();
int ccId = c.getCategory().getId(); int ccId = c.getCategory().getId();
int cId = c.getId(); int cId = c.getId();
@ -173,12 +225,21 @@ public class PlayerManager {
* @return The number of time specific challenge has been done by player * @return The number of time specific challenge has been done by player
*/ */
public int getChallengeCount(UUID uuid, Challenge c) { public int getChallengeCount(UUID uuid, Challenge c) {
HashMap<Challenge, Integer> challenges = players.get(uuid); HashMap<Challenge, Integer> challenges = islands.get(uuid);
if (challenges != null) { if (challenges != null) {
return challenges.getOrDefault(c, 0); return challenges.getOrDefault(c, 0);
} else { } else {
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
uuid = is.getOwnerUUID();
}
}
// Not connected, check in file // Not connected, check in file
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory, uuid.toString() + ".yml")); Config config = skyblock.getFileManager().getConfig(new File(playersDirectory,
uuid.toString() + ".yml"));
FileConfiguration fileConfig = config.getFileConfiguration(); FileConfiguration fileConfig = config.getFileConfiguration();
int ccId = c.getCategory().getId(); int ccId = c.getCategory().getId();
int cId = c.getId(); int cId = c.getId();

View File

@ -3,6 +3,7 @@ package com.songoda.skyblock.command.commands.island;
import java.io.File; import java.io.File;
import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.island.IslandManager;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -24,6 +25,7 @@ public class ChallengeCommand extends SubCommand {
SoundManager soundManager = skyblock.getSoundManager(); SoundManager soundManager = skyblock.getSoundManager();
FileManager fileManager = skyblock.getFileManager(); FileManager fileManager = skyblock.getFileManager();
FabledChallenge fabledChallenge = skyblock.getFabledChallenge(); FabledChallenge fabledChallenge = skyblock.getFabledChallenge();
IslandManager islandManager = skyblock.getIslandManager();
Config langConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); Config langConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
FileConfiguration langConfigLoad = langConfig.getFileConfiguration(); FileConfiguration langConfigLoad = langConfig.getFileConfiguration();
@ -36,6 +38,15 @@ public class ChallengeCommand extends SubCommand {
return; return;
} }
if (args.length == 0) { if (args.length == 0) {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland")){
if(islandManager.getIsland(player) == null){
messageManager.sendMessage(player, langConfigLoad.getString("Command.Island.Challenge.NoIsland.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
}
// Open challenge inventory // Open challenge inventory
ChallengeCategory cc = fabledChallenge.getChallengeManager().getChallenge(1); ChallengeCategory cc = fabledChallenge.getChallengeManager().getChallenge(1);
if (cc == null) { if (cc == null) {

View File

@ -1,22 +1,27 @@
package com.songoda.skyblock.command.commands.island; package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.api.event.player.PlayerIslandChatEvent;
import com.songoda.skyblock.api.event.player.PlayerIslandChatSwitchEvent; import com.songoda.skyblock.api.event.player.PlayerIslandChatSwitchEvent;
import com.songoda.skyblock.command.SubCommand; import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island; import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager; import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole; import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager; import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.placeholder.PlaceholderManager;
import com.songoda.skyblock.playerdata.PlayerData; import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager; import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager; import com.songoda.skyblock.sound.SoundManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.io.File; import java.io.File;
import java.util.UUID;
public class ChatCommand extends SubCommand { public class ChatCommand extends SubCommand {
@ -26,6 +31,7 @@ public class ChatCommand extends SubCommand {
MessageManager messageManager = skyblock.getMessageManager(); MessageManager messageManager = skyblock.getMessageManager();
IslandManager islandManager = skyblock.getIslandManager(); IslandManager islandManager = skyblock.getIslandManager();
SoundManager soundManager = skyblock.getSoundManager(); SoundManager soundManager = skyblock.getSoundManager();
FileManager fileManager = skyblock.getFileManager();
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")); Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
@ -33,32 +39,73 @@ public class ChatCommand extends SubCommand {
Island island = islandManager.getIsland(player); Island island = islandManager.getIsland(player);
PlayerData playerData = playerDataManager.getPlayerData(player); PlayerData playerData = playerDataManager.getPlayerData(player);
if (playerData.isChat() && island != null) { if(args.length == 0){
Bukkit.getServer().getPluginManager() if (playerData.isChat() && island != null) {
.callEvent(new PlayerIslandChatSwitchEvent(player, island.getAPIWrapper(), false)); Bukkit.getServer().getPluginManager()
playerData.setChat(false); .callEvent(new PlayerIslandChatSwitchEvent(player, island.getAPIWrapper(), false));
playerData.setChat(false);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Untoggled.Message")); messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Untoggled.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
return; return;
} }
if (island == null) { if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Owner.Message")); messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Owner.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if ((island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size()) == 0) { } else if ((island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size()) == 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Team.Message")); messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Team.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if ((islandManager.getMembersOnline(island).size() - 1) <= 0) { } else if ((islandManager.getMembersOnline(island).size() - 1) <= 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Offline.Message")); messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Offline.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
Bukkit.getServer().getPluginManager()
.callEvent(new PlayerIslandChatSwitchEvent(player, island.getAPIWrapper(), true));
playerData.setChat(true);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Toggled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
} else { } else {
Bukkit.getServer().getPluginManager() if (playerDataManager.hasPlayerData(player)) {
.callEvent(new PlayerIslandChatSwitchEvent(player, island.getAPIWrapper(), true)); if (playerData.getOwner() != null) {
playerData.setChat(true); island = skyblock.getIslandManager().getIsland(player);
}
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Toggled.Message")); String islandRole = "";
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
if (island.hasRole(IslandRole.Member, player.getUniqueId())) {
islandRole = configLoad.getString("Island.Chat.Format.Role.Member");
} else if (island.hasRole(IslandRole.Operator, player.getUniqueId())) {
islandRole = configLoad.getString("Island.Chat.Format.Role.Operator");
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
islandRole = configLoad.getString("Island.Chat.Format.Role.Owner");
}
Island finalIsland = island;
String finalIslandRole = islandRole;
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
PlayerIslandChatEvent islandChatEvent = new PlayerIslandChatEvent(player, finalIsland.getAPIWrapper(),
String.join(" ", args), configLoad.getString("Island.Chat.Format.Message"));
Bukkit.getServer().getPluginManager().callEvent(islandChatEvent);
if (!islandChatEvent.isCancelled()) {
for (UUID islandMembersOnlineList : islandManager.getMembersOnline(finalIsland)) {
Player targetPlayer = Bukkit.getServer().getPlayer(islandMembersOnlineList);
String message = ChatColor.translateAlternateColorCodes('&', messageManager.replaceMessage(targetPlayer,
islandChatEvent.getFormat().replace("%role", finalIslandRole).replace("%player", player.getName())))
.replace("%message", islandChatEvent.getMessage());
targetPlayer.sendMessage(message);
}
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Chat.OutputToConsole")) {
messageManager.sendMessage(Bukkit.getConsoleSender(), islandChatEvent.getFormat().replace("%role", finalIslandRole).replace("%player", player.getName())
.replace("%message", islandChatEvent.getMessage()));
}
}
});
}
} }
} }

View File

@ -5,6 +5,10 @@ import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager; import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.confirmation.Confirmation; import com.songoda.skyblock.confirmation.Confirmation;
import com.songoda.skyblock.cooldown.Cooldown;
import com.songoda.skyblock.cooldown.CooldownManager;
import com.songoda.skyblock.cooldown.CooldownPlayer;
import com.songoda.skyblock.cooldown.CooldownType;
import com.songoda.skyblock.island.Island; import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager; import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole; import com.songoda.skyblock.island.IslandRole;
@ -12,6 +16,7 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerData; import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager; import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent; import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.skyblock.utils.NumberUtil;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.ComponentBuilder;
@ -28,6 +33,7 @@ public class DeleteCommand extends SubCommand {
@Override @Override
public void onCommandByPlayer(Player player, String[] args) { public void onCommandByPlayer(Player player, String[] args) {
CooldownManager cooldownManager = skyblock.getCooldownManager();
MessageManager messageManager = skyblock.getMessageManager(); MessageManager messageManager = skyblock.getMessageManager();
IslandManager islandManager = skyblock.getIslandManager(); IslandManager islandManager = skyblock.getIslandManager();
SoundManager soundManager = skyblock.getSoundManager(); SoundManager soundManager = skyblock.getSoundManager();
@ -44,6 +50,32 @@ public class DeleteCommand extends SubCommand {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Delete.Owner.Message")); messageManager.sendMessage(player, configLoad.getString("Command.Island.Delete.Owner.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())) { } else if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Creation.Cooldown.Creation.Enable")
&& cooldownManager.hasPlayer(CooldownType.Deletion, player)) {
CooldownPlayer cooldownPlayer = cooldownManager.getCooldownPlayer(CooldownType.Deletion, player);
Cooldown cooldown = cooldownPlayer.getCooldown();
if (cooldown.getTime() < 60) {
messageManager.sendMessage(player,
config.getFileConfiguration().getString("Island.Deletion.Cooldown.Message") // TODO Add language.yml values
.replace("%time", cooldown.getTime() + " " + config.getFileConfiguration()
.getString("Island.Deletion.Cooldown.Word.Second")));
} else {
long[] durationTime = NumberUtil.getDuration(cooldown.getTime());
messageManager.sendMessage(player,
config.getFileConfiguration().getString("Island.Deletion.Cooldown.Message")
.replace("%time", durationTime[2] + " "
+ config.getFileConfiguration()
.getString("Island.Deletion.Cooldown.Word.Minute")
+ " " + durationTime[3] + " " + config.getFileConfiguration()
.getString("Island.Deletion.Cooldown.Word.Second")));
}
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
return;
}
if (playerData.getConfirmationTime() > 0) { if (playerData.getConfirmationTime() > 0) {
messageManager.sendMessage(player, messageManager.sendMessage(player,
configLoad.getString("Command.Island.Delete.Confirmation.Pending.Message")); configLoad.getString("Command.Island.Delete.Confirmation.Pending.Message"));

View File

@ -49,7 +49,9 @@ public class KickAllCommand extends SubCommand {
for (UUID islandVisitorList : islandVisitors) { for (UUID islandVisitorList : islandVisitors) {
Player targetPlayer = Bukkit.getServer().getPlayer(islandVisitorList); Player targetPlayer = Bukkit.getServer().getPlayer(islandVisitorList);
if (targetPlayer != null && targetPlayer.hasPermission("fabledskyblock.bypass.ban")) if (targetPlayer != null &&
(targetPlayer.hasPermission("fabledskyblock.bypass.ban") ||
targetPlayer.hasPermission("fabledskyblock.bypass.kick")))
continue; continue;
IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(), IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(),

View File

@ -72,7 +72,12 @@ public class KickCommand extends SubCommand {
targetPlayerName = targetPlayer.getName(); targetPlayerName = targetPlayer.getName();
} }
if (targetPlayerUUID.equals(player.getUniqueId())) { assert targetPlayer != null;
if(targetPlayer.hasPermission("fabledskyblock.bypass.kick") && islandVisitors.contains(targetPlayer.getUniqueId())){
// messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Exempt")); // TODO
messageManager.sendMessage(player, "&cNon puoi cacciare questo utente!");
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (targetPlayerUUID.equals(player.getUniqueId())) {
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Yourself.Message")); messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Yourself.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (islandOperators.contains(player.getUniqueId()) && islandOperators.contains(targetPlayerUUID)) { } else if (islandOperators.contains(player.getUniqueId()) && islandOperators.contains(targetPlayerUUID)) {

View File

@ -11,9 +11,13 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager; import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager; import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer; import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.visit.Visit; import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.visit.VisitManager; import com.songoda.skyblock.visit.VisitManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -105,8 +109,13 @@ public class TeleportCommand extends SubCommand {
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
Bukkit.getServer().getScheduler().runTask(skyblock, () -> { Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main)); Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Main);
player.setFallDistance(0.0F); LocationUtil.removeWaterFromLoc(skyblock, loc);
player.teleport(loc);
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
}); });
} }
} }

View File

@ -36,7 +36,7 @@ public class CooldownManager {
for (Player all : Bukkit.getOnlinePlayers()) { for (Player all : Bukkit.getOnlinePlayers()) {
CooldownPlayer cooldownPlayer = null; CooldownPlayer cooldownPlayer = null;
if (cooldownTypeList == CooldownType.Biome || cooldownTypeList == CooldownType.Creation) { if (cooldownTypeList == CooldownType.Biome || cooldownTypeList == CooldownType.Creation || cooldownTypeList == CooldownType.Deletion) {
cooldownPlayer = loadCooldownPlayer(cooldownTypeList, all); cooldownPlayer = loadCooldownPlayer(cooldownTypeList, all);
} else if (cooldownTypeList == CooldownType.Levelling || cooldownTypeList == CooldownType.Ownership) { } else if (cooldownTypeList == CooldownType.Levelling || cooldownTypeList == CooldownType.Ownership) {
Island island = islandManager.getIsland(all); Island island = islandManager.getIsland(all);
@ -69,7 +69,7 @@ public class CooldownManager {
} }
public CooldownPlayer loadCooldownPlayer(CooldownType cooldownType, OfflinePlayer player) { public CooldownPlayer loadCooldownPlayer(CooldownType cooldownType, OfflinePlayer player) {
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation) { if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
Config config = skyblock.getFileManager() Config config = skyblock.getFileManager()
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml")); .getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml"));
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
@ -99,7 +99,7 @@ public class CooldownManager {
int time = 0; int time = 0;
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation) { if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
time = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration() time = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getInt("Island." + cooldownType.name() + ".Cooldown.Time"); .getInt("Island." + cooldownType.name() + ".Cooldown.Time");
@ -139,7 +139,7 @@ public class CooldownManager {
public void deletePlayer(CooldownType cooldownType, OfflinePlayer player) { public void deletePlayer(CooldownType cooldownType, OfflinePlayer player) {
for (Iterator<CooldownPlayer> it = getCooldownPlayersOrEmptyList(cooldownType).iterator(); it.hasNext();) { for (Iterator<CooldownPlayer> it = getCooldownPlayersOrEmptyList(cooldownType).iterator(); it.hasNext();) {
if (it.next().getUUID().equals(player.getUniqueId())) { if (it.next().getUUID().equals(player.getUniqueId())) {
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation) { if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
skyblock.getFileManager() skyblock.getFileManager()
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), .getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"),
player.getUniqueId().toString() + ".yml")) player.getUniqueId().toString() + ".yml"))
@ -197,7 +197,7 @@ public class CooldownManager {
public void setCooldownPlayer(CooldownType cooldownType, OfflinePlayer player) { public void setCooldownPlayer(CooldownType cooldownType, OfflinePlayer player) {
for (CooldownPlayer cooldownPlayerList : getCooldownPlayersOrEmptyList(cooldownType)) { for (CooldownPlayer cooldownPlayerList : getCooldownPlayersOrEmptyList(cooldownType)) {
if (cooldownPlayerList.getUUID().equals(player.getUniqueId())) { if (cooldownPlayerList.getUUID().equals(player.getUniqueId())) {
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation) { if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
skyblock.getFileManager() skyblock.getFileManager()
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), .getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"),
player.getUniqueId().toString() + ".yml")) player.getUniqueId().toString() + ".yml"))
@ -222,7 +222,7 @@ public class CooldownManager {
public void saveCooldownPlayer(CooldownType cooldownType, OfflinePlayer player) { public void saveCooldownPlayer(CooldownType cooldownType, OfflinePlayer player) {
Config config = null; Config config = null;
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation) { if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
config = skyblock.getFileManager() config = skyblock.getFileManager()
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml")); .getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml"));
} else if (cooldownType == CooldownType.Levelling || cooldownType == CooldownType.Ownership) { } else if (cooldownType == CooldownType.Levelling || cooldownType == CooldownType.Ownership) {

View File

@ -8,6 +8,7 @@ public enum CooldownType {
Biome, Biome,
Creation, Creation,
Deletion,
Levelling, Levelling,
Ownership, Ownership,
Teleport; Teleport;

View File

@ -1,19 +1,22 @@
package com.songoda.skyblock.generator; package com.songoda.skyblock.generator;
import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.island.IslandWorld;
import java.util.List; import java.util.List;
public class Generator { public class Generator {
private String name; private String name;
private IslandWorld isWorld;
private CompatibleMaterial materials; private CompatibleMaterial materials;
private List<GeneratorMaterial> generatorMaterials; private List<GeneratorMaterial> generatorMaterials;
private boolean permission; private boolean permission;
public Generator(String name, CompatibleMaterial materials, List<GeneratorMaterial> generatorMaterials, boolean permission) { public Generator(String name, IslandWorld isWorld, CompatibleMaterial materials, List<GeneratorMaterial> generatorMaterials, boolean permission) {
this.name = name; this.name = name;
this.isWorld = isWorld;
this.materials = materials; this.materials = materials;
this.generatorMaterials = generatorMaterials; this.generatorMaterials = generatorMaterials;
this.permission = permission; this.permission = permission;
@ -23,6 +26,10 @@ public class Generator {
return name; return name;
} }
public IslandWorld getIsWorld() {
return isWorld;
}
public CompatibleMaterial getMaterials() { public CompatibleMaterial getMaterials() {
return materials; return materials;
} }

View File

@ -4,7 +4,8 @@ import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.utils.version.NMSUtil; import com.songoda.skyblock.utils.version.NMSUtil;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
@ -56,6 +57,7 @@ public class GeneratorManager {
} }
generatorStorage.add(new Generator(configLoad.getString("Generators." + generatorList + ".Name"), generatorStorage.add(new Generator(configLoad.getString("Generators." + generatorList + ".Name"),
IslandWorld.valueOf(configLoad.getString("Generators." + generatorList + ".World", "Normal")),
oreMaterials[rnd.nextInt(oreMaterials.length)], generatorMaterials, oreMaterials[rnd.nextInt(oreMaterials.length)], generatorMaterials,
configLoad.getBoolean("Generators." + generatorList + ".Permission"))); configLoad.getBoolean("Generators." + generatorList + ".Permission")));
} }
@ -150,10 +152,10 @@ public class GeneratorManager {
return CompatibleMaterial.COBBLESTONE; return CompatibleMaterial.COBBLESTONE;
} }
public void addGenerator(String name, List<GeneratorMaterial> generatorMaterials, boolean permission) { public void addGenerator(String name, IslandWorld isWorld, List<GeneratorMaterial> generatorMaterials, boolean permission) {
CompatibleMaterial[] oreMaterials = new CompatibleMaterial[]{CompatibleMaterial.COAL, CompatibleMaterial.CHARCOAL, CompatibleMaterial.DIAMOND, CompatibleMaterial[] oreMaterials = new CompatibleMaterial[]{CompatibleMaterial.COAL, CompatibleMaterial.CHARCOAL, CompatibleMaterial.DIAMOND,
CompatibleMaterial.IRON_INGOT, CompatibleMaterial.GOLD_INGOT, CompatibleMaterial.EMERALD}; CompatibleMaterial.IRON_INGOT, CompatibleMaterial.GOLD_INGOT, CompatibleMaterial.EMERALD};
generatorStorage.add(new Generator(name, oreMaterials[new Random().nextInt(oreMaterials.length)], generatorStorage.add(new Generator(name, isWorld, oreMaterials[new Random().nextInt(oreMaterials.length)],
generatorMaterials, permission)); generatorMaterials, permission));
} }

View File

@ -52,7 +52,6 @@ public class Island {
this.skyblock = SkyBlock.getInstance(); this.skyblock = SkyBlock.getInstance();
FileManager fileManager = skyblock.getFileManager(); FileManager fileManager = skyblock.getFileManager();
PermissionManager permissionManager = skyblock.getPermissionManager();
this.islandUUID = UUID.randomUUID(); this.islandUUID = UUID.randomUUID();
this.ownerUUID = player.getUniqueId(); this.ownerUUID = player.getUniqueId();
@ -113,7 +112,7 @@ public class Island {
} }
if (configLoad.getString("Border") == null) { if (configLoad.getString("Border") == null) {
configLoad.set("Border.Enable", true); configLoad.set("Border.Enable", mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Default", false));
configLoad.set("Border.Color", WorldBorder.Color.Blue.name()); configLoad.set("Border.Color", WorldBorder.Color.Blue.name());
} }
@ -162,10 +161,10 @@ public class Island {
} }
for (IslandRole roleList : IslandRole.getRoles()) { for (IslandRole roleList : IslandRole.getRoles()) {
List<IslandPermission> permissions = new ArrayList<>(); List<BasicPermission> allPermissions = skyblock.getPermissionManager().getPermissions();
List<IslandPermission> permissions = new ArrayList<>(allPermissions.size());
for (BasicPermission permission : skyblock.getPermissionManager().getPermissions()) {
for (BasicPermission permission : allPermissions) {
if (settingsDataConfig == null || settingsDataConfig.getFileConfiguration() if (settingsDataConfig == null || settingsDataConfig.getFileConfiguration()
.getString("Settings." + roleList.name() + "." + permission.getName()) == null) { .getString("Settings." + roleList.name() + "." + permission.getName()) == null) {
permissions.add( permissions.add(
@ -184,10 +183,10 @@ public class Island {
configLoad.set("UUID", islandUUID.toString()); configLoad.set("UUID", islandUUID.toString());
configLoad.set("Visitor.Open", mainConfigLoad.getBoolean("Island.Visitor.Open")); configLoad.set("Visitor.Open", mainConfigLoad.getBoolean("Island.Visitor.Open"));
configLoad.set("Border.Enable", true); configLoad.set("Border.Enable", mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Default", false));
configLoad.set("Border.Color", WorldBorder.Color.Blue.name()); configLoad.set("Border.Color", WorldBorder.Color.Blue.name());
configLoad.set("Biome.Type", mainConfigLoad.getString("Island.Biome.Default.Type").toUpperCase()); configLoad.set("Biome.Type", mainConfigLoad.getString("Island.Biome.Default.Type").toUpperCase());
configLoad.set("Weather.Synchronised", mainConfigLoad.getBoolean("Island.Weather.Default.Synchronised")); configLoad.set("Weather.Synchronised", mainConfigLoad.getBoolean("Island.Weather.Default.Synchronised")); // TODO: Synchronized
configLoad.set("Weather.Time", mainConfigLoad.getInt("Island.Weather.Default.Time")); configLoad.set("Weather.Time", mainConfigLoad.getInt("Island.Weather.Default.Time"));
configLoad.set("Weather.Weather", mainConfigLoad.getString("Island.Weather.Default.Weather").toUpperCase()); configLoad.set("Weather.Weather", mainConfigLoad.getString("Island.Weather.Default.Weather").toUpperCase());
configLoad.set("Ownership.Original", ownerUUID.toString()); configLoad.set("Ownership.Original", ownerUUID.toString());
@ -198,7 +197,8 @@ public class Island {
for (BasicPermission permission : allPermissions) { for (BasicPermission permission : allPermissions) {
permissions.add( permissions.add(
new IslandPermission(permission, defaultSettingsConfig.getFileConfiguration().getBoolean("Settings." + roleList.name() + "." + permission, true))); new IslandPermission(permission, defaultSettingsConfig.getFileConfiguration()
.getBoolean("Settings." + roleList.name() + "." + permission.getName(), true)));
} }
islandPermissions.put(roleList, permissions); islandPermissions.put(roleList, permissions);

View File

@ -114,7 +114,15 @@ public class IslandLevel {
division = 1; division = 1;
} }
return getPoints() / division; long points = getPoints();
long subtract = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getLong("Island.Levelling.Subtract");
if(points >= subtract){
points -= subtract;
} else {
points = 0;
}
return points / division;
} }
public void checkLevelUp() { public void checkLevelUp() {

View File

@ -61,7 +61,7 @@ public class IslandManager {
private List<IslandPosition> islandPositions = new ArrayList<>(); private List<IslandPosition> islandPositions = new ArrayList<>();
private Map<UUID, UUID> islandProxies = new HashMap<>(); private Map<UUID, UUID> islandProxies = new HashMap<>();
private Map<UUID, Island> islandStorage = new HashMap<>(); private Map<UUID, Island> islandStorage = new HashMap<>();
private int offset = 1200; private int offset;
private HashMap<IslandWorld, Integer> oldSystemIslands; private HashMap<IslandWorld, Integer> oldSystemIslands;
@ -71,6 +71,9 @@ public class IslandManager {
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "worlds.yml")); Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "worlds.yml"));
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
offset = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Creation.Distance", 1200);
for (IslandWorld worldList : IslandWorld.values()) { for (IslandWorld worldList : IslandWorld.values()) {
ConfigurationSection configSection = configLoad.getConfigurationSection("World." + worldList.name() + ".nextAvailableLocation"); ConfigurationSection configSection = configLoad.getConfigurationSection("World." + worldList.name() + ".nextAvailableLocation");
islandPositions.add(new IslandPosition(worldList, configSection.getDouble("x"), configSection.getDouble("z"))); islandPositions.add(new IslandPosition(worldList, configSection.getDouble("x"), configSection.getDouble("z")));
@ -241,6 +244,9 @@ public class IslandManager {
if (configLoad.getBoolean("Island.Creation.Cooldown.Creation.Enable") && !player.hasPermission("fabledskyblock.bypass.cooldown") && !player.hasPermission("fabledskyblock.bypass.*") if (configLoad.getBoolean("Island.Creation.Cooldown.Creation.Enable") && !player.hasPermission("fabledskyblock.bypass.cooldown") && !player.hasPermission("fabledskyblock.bypass.*")
&& !player.hasPermission("fabledskyblock.*")) && !player.hasPermission("fabledskyblock.*"))
skyblock.getCooldownManager().createPlayer(CooldownType.Creation, player); skyblock.getCooldownManager().createPlayer(CooldownType.Creation, player);
if (configLoad.getBoolean("Island.Deletion.Cooldown.Deletion.Enable") && !player.hasPermission("fabledskyblock.bypass.cooldown") && !player.hasPermission("fabledskyblock.bypass.*")
&& !player.hasPermission("fabledskyblock.*"))
skyblock.getCooldownManager().createPlayer(CooldownType.Deletion, player);
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(new IslandCreateEvent(island.getAPIWrapper(), player))); Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(new IslandCreateEvent(island.getAPIWrapper(), player)));
@ -455,6 +461,16 @@ public class IslandManager {
fileManager.unloadConfig(newIslandDataFile); fileManager.unloadConfig(newIslandDataFile);
oldIslandDataFile.renameTo(newIslandDataFile); oldIslandDataFile.renameTo(newIslandDataFile);
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)){
File oldChallengeDataFile = new File(new File(skyblock.getDataFolder().toString() + "/challenge-data"), uuid2.toString() + ".yml");
File newChallengeDataFile = new File(new File(skyblock.getDataFolder().toString() + "/challenge-data"), player.getUniqueId().toString() + ".yml");
fileManager.unloadConfig(oldChallengeDataFile);
fileManager.unloadConfig(newChallengeDataFile);
oldChallengeDataFile.renameTo(newChallengeDataFile);
}
skyblock.getVisitManager().transfer(uuid2, player.getUniqueId()); skyblock.getVisitManager().transfer(uuid2, player.getUniqueId());
skyblock.getBanManager().transfer(uuid2, player.getUniqueId()); skyblock.getBanManager().transfer(uuid2, player.getUniqueId());
skyblock.getInviteManager().tranfer(uuid2, player.getUniqueId()); skyblock.getInviteManager().tranfer(uuid2, player.getUniqueId());
@ -509,8 +525,6 @@ public class IslandManager {
} }
} }
int j = 0;
public boolean deleteIsland(Island island, boolean force) { public boolean deleteIsland(Island island, boolean force) {
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager(); ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
@ -566,7 +580,8 @@ public class IslandManager {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")); Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
boolean cooldownEnabled = configLoad.getBoolean("Island.Creation.Cooldown.Deletion.Enable"); boolean cooldownCreationEnabled = configLoad.getBoolean("Island.Creation.Cooldown.Creation.Enable");
boolean cooldownDeletionEnabled = configLoad.getBoolean("Island.Creation.Cooldown.Deletion.Enable");
config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
configLoad = config.getFileConfiguration(); configLoad = config.getFileConfiguration();
@ -590,11 +605,26 @@ public class IslandManager {
LocationUtil.teleportPlayerToSpawn(all); LocationUtil.teleportPlayerToSpawn(all);
} }
if (cooldownEnabled) { // TODO - Find a way to delete also offline players
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Deletion.ClearInventory", false)){
all.getInventory().clear();
}
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Deletion.ClearEnderChest", false)){
all.getEnderChest().clear();
}
if (cooldownCreationEnabled) {
if (!all.hasPermission("fabledskyblock.bypass.cooldown") && !all.hasPermission("fabledskyblock.bypass.*") && !all.hasPermission("fabledskyblock.*")) { if (!all.hasPermission("fabledskyblock.bypass.cooldown") && !all.hasPermission("fabledskyblock.bypass.*") && !all.hasPermission("fabledskyblock.*")) {
skyblock.getCooldownManager().createPlayer(CooldownType.Creation, all); skyblock.getCooldownManager().createPlayer(CooldownType.Creation, all);
} }
} }
if (cooldownDeletionEnabled) {
if (!all.hasPermission("fabledskyblock.bypass.cooldown") && !all.hasPermission("fabledskyblock.bypass.*") && !all.hasPermission("fabledskyblock.*")) {
skyblock.getCooldownManager().createPlayer(CooldownType.Deletion, all);
}
}
} }
InviteManager inviteManager = skyblock.getInviteManager(); InviteManager inviteManager = skyblock.getInviteManager();
@ -612,6 +642,10 @@ public class IslandManager {
fileManager.deleteConfig(new File(new File(skyblock.getDataFolder().toString() + "/level-data"), island.getOwnerUUID().toString() + ".yml")); fileManager.deleteConfig(new File(new File(skyblock.getDataFolder().toString() + "/level-data"), island.getOwnerUUID().toString() + ".yml"));
fileManager.deleteConfig(new File(new File(skyblock.getDataFolder().toString() + "/setting-data"), island.getOwnerUUID().toString() + ".yml")); fileManager.deleteConfig(new File(new File(skyblock.getDataFolder().toString() + "/setting-data"), island.getOwnerUUID().toString() + ".yml"));
fileManager.deleteConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"), island.getOwnerUUID().toString() + ".yml")); fileManager.deleteConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"), island.getOwnerUUID().toString() + ".yml"));
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)){
fileManager.deleteConfig(new File(new File(skyblock.getDataFolder().toString() + "/challenge-data"), island.getOwnerUUID().toString() + ".yml"));
}
Bukkit.getServer().getPluginManager().callEvent(new IslandDeleteEvent(island.getAPIWrapper())); Bukkit.getServer().getPluginManager().callEvent(new IslandDeleteEvent(island.getAPIWrapper()));
@ -627,6 +661,10 @@ public class IslandManager {
fileManager.deleteConfig(new File(skyblock.getDataFolder().toString() + "/level-data", uuid.toString() + ".yml")); fileManager.deleteConfig(new File(skyblock.getDataFolder().toString() + "/level-data", uuid.toString() + ".yml"));
fileManager.deleteConfig(new File(skyblock.getDataFolder().toString() + "/setting-data", uuid.toString() + ".yml")); fileManager.deleteConfig(new File(skyblock.getDataFolder().toString() + "/setting-data", uuid.toString() + ".yml"));
fileManager.deleteConfig(new File(skyblock.getDataFolder().toString() + "/visit-data", uuid.toString() + ".yml")); fileManager.deleteConfig(new File(skyblock.getDataFolder().toString() + "/visit-data", uuid.toString() + ".yml"));
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)){
fileManager.deleteConfig(new File(skyblock.getDataFolder().toString() + "/challenge-data", uuid.toString() + ".yml"));
}
} }
public Island loadIsland(org.bukkit.OfflinePlayer player) { public Island loadIsland(org.bukkit.OfflinePlayer player) {
@ -851,6 +889,11 @@ public class IslandManager {
fileManager.unloadConfig(new File(new File(skyblock.getDataFolder().toString() + "/setting-data"), island.getOwnerUUID() + ".yml")); fileManager.unloadConfig(new File(new File(skyblock.getDataFolder().toString() + "/setting-data"), island.getOwnerUUID() + ".yml"));
fileManager.unloadConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"), island.getOwnerUUID() + ".yml")); fileManager.unloadConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"), island.getOwnerUUID() + ".yml"));
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)){
fileManager.unloadConfig(new File(new File(skyblock.getDataFolder().toString() + "/challenge-data"), island.getOwnerUUID() + ".yml"));
}
islandStorage.remove(island.getOwnerUUID()); islandStorage.remove(island.getOwnerUUID());
Bukkit.getServer().getPluginManager().callEvent(new IslandUnloadEvent(island.getAPIWrapper())); Bukkit.getServer().getPluginManager().callEvent(new IslandUnloadEvent(island.getAPIWrapper()));
@ -1033,8 +1076,17 @@ public class IslandManager {
FileConfiguration configLoad = languageConfig.getFileConfiguration(); FileConfiguration configLoad = languageConfig.getFileConfiguration();
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId()) || island.hasRole(IslandRole.Owner, player.getUniqueId())) { if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId()) || island.hasRole(IslandRole.Owner, player.getUniqueId())) {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor)); Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Main);
player.setFallDistance(0.0F); if(loc != null){
player.teleport(loc);
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
} else {
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
Objects.requireNonNull(skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Teleport.Unsafe.Message"))));
}
} else { } else {
if (scoreboardManager != null) { if (scoreboardManager != null) {
int islandVisitors = getVisitorsAtIsland(island).size(), islandMembers = island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size() + 1; int islandVisitors = getVisitorsAtIsland(island).size(), islandMembers = island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size() + 1;
@ -1052,8 +1104,6 @@ public class IslandManager {
} else { } else {
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Scoreboard.Island.Team.Displayname"))); scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Scoreboard.Island.Team.Displayname")));
scoreboard.setDisplayList(configLoad.getStringList("Scoreboard.Island.Team.Occupied.Displaylines")); scoreboard.setDisplayList(configLoad.getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
} }
scoreboard.run(); scoreboard.run();
@ -1063,8 +1113,23 @@ public class IslandManager {
} }
Bukkit.getServer().getScheduler().runTask(skyblock, () -> { Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor)); Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor);
player.setFallDistance(0.0F); if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
loc = LocationUtil.getSafeLocation(loc);
}
if(loc != null){
player.teleport(loc);
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
} else {
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Command.Island.Teleport.Unsafe.Message")));
}
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
}); });
List<String> islandWelcomeMessage = island.getMessage(IslandMessage.Welcome); List<String> islandWelcomeMessage = island.getMessage(IslandMessage.Welcome);
@ -1429,7 +1494,7 @@ public class IslandManager {
} }
for (Player all : getPlayersAtIsland(island)) { for (Player all : getPlayersAtIsland(island)) {
WorldBorder.send(all, island.getBorderColor(), island.getSize(), island.getLocation(worldManager.getIslandWorld(all.getWorld()), IslandEnvironment.Island)); WorldBorder.send(all, island.getBorderColor(), island.getSize()+2, island.getLocation(worldManager.getIslandWorld(all.getWorld()), IslandEnvironment.Island));
} }
} }
} }

View File

@ -7,6 +7,8 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.limit.EnumLimitation; import com.songoda.skyblock.limit.EnumLimitation;
import com.songoda.skyblock.utils.player.PlayerUtil; import com.songoda.skyblock.utils.player.PlayerUtil;
import com.songoda.skyblock.utils.version.CompatibleSpawners; import com.songoda.skyblock.utils.version.CompatibleSpawners;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -54,13 +56,16 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
} }
@SuppressWarnings("deprecation")
public long getBlockLimit(Player player, Block block) { public long getBlockLimit(Player player, Block block) {
if (player == null || block == null) return -1; return this.getBlockLimit(player, block.getType());
}
public long getBlockLimit(Player player, Material type) {
if (player == null || type == null) return -1;
if (player.hasPermission("fabledskyblock.limit.block.*")) return -1; if (player.hasPermission("fabledskyblock.limit.block.*")) return -1;
final CompatibleMaterial material = CompatibleMaterial.getMaterial(block.getType()); final CompatibleMaterial material = CompatibleMaterial.getMaterial(type);
if (material == null) return -1; if (material == null) return -1;
@ -69,19 +74,22 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
return Math.max(getMap().getOrDefault(material, getDefault()), PlayerUtil.getNumberFromPermission(player, "fabledskyblock.limit.block." + name, true, -1)); return Math.max(getMap().getOrDefault(material, getDefault()), PlayerUtil.getNumberFromPermission(player, "fabledskyblock.limit.block." + name, true, -1));
} }
@SuppressWarnings("deprecation")
public boolean isBlockLimitExceeded(Block block, long limit) { public boolean isBlockLimitExceeded(Block block, long limit) {
return this.isBlockLimitExceeded(block.getType(), block.getLocation(), limit);
}
public boolean isBlockLimitExceeded(Material type, Location loc, long limit) {
if (limit == -1) return false; if (limit == -1) return false;
final IslandManager islandManager = SkyBlock.getInstance().getIslandManager(); final IslandManager islandManager = SkyBlock.getInstance().getIslandManager();
final Island island = islandManager.getIslandAtLocation(block.getLocation()); final Island island = islandManager.getIslandAtLocation(loc);
final long totalPlaced; final long totalPlaced;
if (block.getType() == CompatibleMaterial.SPAWNER.getBlockMaterial()) { if (type == CompatibleMaterial.SPAWNER.getBlockMaterial()) {
totalPlaced = island.getLevel().getMaterials().entrySet().stream().filter(x -> x.getKey().contains("SPAWNER")).mapToLong(Map.Entry::getValue).sum(); totalPlaced = island.getLevel().getMaterials().entrySet().stream().filter(x -> x.getKey().contains("SPAWNER")).mapToLong(Map.Entry::getValue).sum();
} else { } else {
totalPlaced = island.getLevel().getMaterialAmount(CompatibleMaterial.getMaterial(block.getType()).name()); totalPlaced = island.getLevel().getMaterialAmount(CompatibleMaterial.getMaterial(type).name());
} }
return limit <= totalPlaced; return limit <= totalPlaced;

View File

@ -20,14 +20,13 @@ import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.world.LocationUtil; import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.world.WorldManager; import com.songoda.skyblock.world.WorldManager;
import org.apache.commons.lang.WordUtils; import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.CreatureSpawner; import org.bukkit.block.CreatureSpawner;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -192,6 +191,10 @@ public class Block implements Listener {
Island island = islandManager.getIslandAtLocation(blockLoc); Island island = islandManager.getIslandAtLocation(blockLoc);
// Check permissions.
if (!skyblock.getPermissionManager().processPermission(event, player, island))
return;
if (island == null) { if (island == null) {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -204,14 +207,34 @@ public class Block implements Listener {
return; return;
} }
// Check permissions.
if (!skyblock.getPermissionManager().processPermission(event, player, island))
return;
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")); Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
IslandWorld world = worldManager.getIslandWorld(block.getWorld()); IslandWorld world = worldManager.getIslandWorld(block.getWorld());
if(!player.hasPermission("fabledskyblock.bypass.netherplace") && !islandManager.isIslandWorldUnlocked(island, IslandWorld.Nether)){
for(String s : Objects.requireNonNull(configLoad.getConfigurationSection("Island.Restrict.NetherBlocks")).getKeys(false)){
if(s.equalsIgnoreCase(block.getType().toString())){
if(configLoad.getBoolean("Island.Restrict.NetherBlocks." + s)){
skyblock.getMessageManager().sendMessage(player, Objects.requireNonNull(skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Unlock.NetherBlocksPlace.Message")));
event.setCancelled(true);
}
}
}
}
if(!player.hasPermission("fabledskyblock.bypass.endplace") && !islandManager.isIslandWorldUnlocked(island, IslandWorld.End)){
for(String s : Objects.requireNonNull(configLoad.getConfigurationSection("Island.Restrict.EndBlocks")).getKeys(false)){
if(s.equalsIgnoreCase(block.getType().toString())){
if(configLoad.getBoolean("Island.Restrict.EndBlocks." + s)){
skyblock.getMessageManager().sendMessage(player, Objects.requireNonNull(skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Unlock.EndBlocksPlace.Message")));
event.setCancelled(true);
}
}
}
}
if (configLoad.getBoolean("Island.WorldBorder.Block") && block.getType() == Material.DISPENSER) { if (configLoad.getBoolean("Island.WorldBorder.Block") && block.getType() == Material.DISPENSER) {
if (!islandManager.isLocationAtIsland(island, blockLoc, world)) { if (!islandManager.isLocationAtIsland(island, blockLoc, world)) {
event.setCancelled(true); event.setCancelled(true);
@ -296,6 +319,32 @@ public class Block implements Listener {
return; return;
} }
// Nether mobs
if(configLoad.getBoolean("Island.Nether.WaterDoNotFlowNearNetherMobs", false) && worldManager.getIslandWorld(block.getWorld()).equals(IslandWorld.Nether)){
Collection<Entity> entities = block.getWorld().getNearbyEntities(block.getLocation(), 1d, 1d, 1d);
if(entities.size() > 0){
EntityCycle: for(Entity ent : entities){
switch(ent.getType()){
case PIG_ZOMBIE:
case BLAZE:
case MAGMA_CUBE:
case WITHER_SKELETON:
case WITHER:
case GHAST:
if(block.getRelative(event.getFace().getOppositeFace()).getType().equals(Material.WATER)){
event.setCancelled(true);
event.getToBlock().getWorld().playSound(block.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f);
event.getToBlock().getWorld().playEffect(block.getLocation(), Effect.SMOKE, 1);
}
break EntityCycle; // TODO No spaghetti code
default:
break;
}
}
}
}
// Generators
if (NMSUtil.getVersionNumber() < 12) { if (NMSUtil.getVersionNumber() < 12) {
if (generatorManager != null && generatorManager.getGenerators().size() > 0 && generatorManager.isGenerator(block)) { if (generatorManager != null && generatorManager.getGenerators().size() > 0 && generatorManager.isGenerator(block)) {
List<Generator> generators = new ArrayList<>(generatorManager.getGenerators()); List<Generator> generators = new ArrayList<>(generatorManager.getGenerators());
@ -313,23 +362,25 @@ public class Block implements Listener {
// Find highest generator available // Find highest generator available
for (Generator generator : generators) { for (Generator generator : generators) {
for (Player p : possiblePlayers) { if(generator.getIsWorld().equals(world)){
for (Player p : possiblePlayers) {
if (generator.isPermission() && if (generator.isPermission() &&
!p.hasPermission(generator.getPermission()) && !p.hasPermission(generator.getPermission()) &&
!p.hasPermission("fabledskyblock.generator.*") && !p.hasPermission("fabledskyblock.generator.*") &&
!p.hasPermission("fabledskyblock.*")) { !p.hasPermission("fabledskyblock.*")) {
continue; continue;
}
org.bukkit.block.BlockState genState = generatorManager.generateBlock(generator, block);
org.bukkit.block.BlockState toBlockState = event.getToBlock().getState();
toBlockState.setData(genState.getData());
toBlockState.setType(genState.getType());
toBlockState.update();
updateLevel(island, genState.getLocation());
return;
} }
org.bukkit.block.BlockState genState = generatorManager.generateBlock(generator, block);
org.bukkit.block.BlockState toBlockState = event.getToBlock().getState();
toBlockState.setData(genState.getData());
toBlockState.setType(genState.getType());
toBlockState.update();
updateLevel(island, genState.getLocation());
return;
} }
} }
} }
@ -534,7 +585,9 @@ public class Block implements Listener {
boolean isMember = island.hasRole(IslandRole.Owner, player.getUniqueId()) || boolean isMember = island.hasRole(IslandRole.Owner, player.getUniqueId()) ||
island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Member, player.getUniqueId()) ||
island.hasRole(IslandRole.Coop, player.getUniqueId()) || island.hasRole(IslandRole.Coop, player.getUniqueId()) ||
island.hasRole(IslandRole.Operator, player.getUniqueId()); island.hasRole(IslandRole.Operator, player.getUniqueId()) ||
(island.getVisit().getVisitors().contains(player.getUniqueId()) &&
player.hasPermission("fabledskyblock.generator.anywhere"));
if (isMember && islandManager.isLocationAtIsland(island, player.getLocation(), world)) { if (isMember && islandManager.isLocationAtIsland(island, player.getLocation(), world)) {
possiblePlayers.add(player); possiblePlayers.add(player);
@ -550,12 +603,14 @@ public class Block implements Listener {
} }
} }
org.bukkit.block.BlockState genState = generatorManager.generateBlock(generator, block); if(worldManager.getIslandWorld(event.getBlock().getWorld()).equals(generator.getIsWorld())){
state.setType(genState.getType()); org.bukkit.block.BlockState genState = generatorManager.generateBlock(generator, block);
state.setType(genState.getType());
if (NMSUtil.getVersionNumber() < 13) state.setData(genState.getData()); if (NMSUtil.getVersionNumber() < 13) state.setData(genState.getData());
updateLevel(island, genState.getLocation()); updateLevel(island, genState.getLocation());
return; return;
}
} }
} }
} }

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.listeners;
import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.*; import com.songoda.skyblock.island.*;
import com.songoda.skyblock.limit.impl.EntityLimitaton; import com.songoda.skyblock.limit.impl.EntityLimitaton;
@ -54,22 +55,32 @@ public class Entity implements Listener {
@EventHandler @EventHandler
public void onEntityDamage(EntityDamageEvent event) { public void onEntityDamage(EntityDamageEvent event) {
IslandManager islandManager = skyblock.getIslandManager(); IslandManager islandManager = skyblock.getIslandManager();
if (!(event.getEntity() instanceof Player)) { if(event.getEntity() instanceof Blaze){
return; WorldManager worldManager = skyblock.getWorldManager();
}
Player player = (Player) event.getEntity(); Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (skyblock.getWorldManager().isIslandWorld(player.getWorld())) { if(configLoad.getBoolean("Island.Nether.BlazeImmuneToWaterInNether", false) &&
// Check permissions. worldManager.getIslandWorld(event.getEntity().getWorld()).equals(IslandWorld.Nether)){
skyblock.getPermissionManager().processPermission(event, player, islandManager.getIslandAtLocation(player.getLocation())); if(event.getCause().equals(DamageCause.DROWNING)){
} event.setCancelled(true);
}
}
} else if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
// Fix a bug in minecraft where arrows with flame still apply fire ticks even if if (skyblock.getWorldManager().isIslandWorld(player.getWorld())) {
// the shot entity isn't damaged // Check permissions.
if (preventFireTicks.contains(player.getUniqueId()) && event.getCause() == DamageCause.FIRE_TICK) { skyblock.getPermissionManager().processPermission(event, player, islandManager.getIslandAtLocation(player.getLocation()));
player.setFireTicks(0); }
event.setCancelled(true);
// Fix a bug in minecraft where arrows with flame still apply fire ticks even if
// the shot entity isn't damaged
if (preventFireTicks.contains(player.getUniqueId()) && event.getCause() == DamageCause.FIRE_TICK) {
player.setFireTicks(0);
event.setCancelled(true);
}
} }
} }
@ -513,12 +524,20 @@ public class Entity implements Listener {
EntityType type = entity.getType(); EntityType type = entity.getType();
if (limits.isBeingTracked(type)) { if (limits.isBeingTracked(type)) {
long count = limits.getEntityCount(island, skyblock.getWorldManager().getIslandWorld(entityLocation.getWorld()), type); FileManager fileManager = skyblock.getFileManager();
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (limits.hasTooMuch(count + 1, type)) { boolean isSplit = event.getSpawnReason().equals(SpawnReason.SLIME_SPLIT);
entity.remove(); boolean splitBypass = configLoad.getBoolean("Island.Challenge.PerIsland", true);
event.setCancelled(true);
return; if(!isSplit || !splitBypass){
long count = limits.getEntityCount(island, skyblock.getWorldManager().getIslandWorld(entityLocation.getWorld()), type);
if (limits.hasTooMuch(count + 1, type)) {
entity.remove();
event.setCancelled(true);
return;
}
} }
} }

View File

@ -18,11 +18,11 @@ import com.songoda.skyblock.stackable.Stackable;
import com.songoda.skyblock.stackable.StackableManager; import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.NumberUtil; import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.structure.StructureUtil; import com.songoda.skyblock.utils.structure.StructureUtil;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.world.WorldManager; import com.songoda.skyblock.world.WorldManager;
import org.apache.commons.lang.WordUtils; import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.GameMode; import org.bukkit.block.BlockFace;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -48,6 +48,87 @@ public class Interact implements Listener {
this.skyblock = skyblock; this.skyblock = skyblock;
} }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onWaterPlace(PlayerInteractEvent event){
if(event.getItem() == null) return;
Player player = event.getPlayer();
org.bukkit.block.Block block = event.getClickedBlock().getRelative(event.getBlockFace());
IslandManager islandManager = skyblock.getIslandManager();
WorldManager worldManager = skyblock.getWorldManager();
IslandLevelManager levellingManager = skyblock.getLevellingManager();
if (!worldManager.isIslandWorld(block.getWorld())) return;
if (event.getAction() == Action.RIGHT_CLICK_BLOCK &&
worldManager.getIslandWorld(block.getWorld()).equals(IslandWorld.Nether) &&
event.getItem().getType().equals(Material.WATER_BUCKET)){
Location blockLoc = block.getLocation();
Island island = islandManager.getIslandAtLocation(blockLoc);
// Check permissions.
if (!skyblock.getPermissionManager().processPermission(event, player, island))
return;
if (island == null) {
event.setCancelled(true);
return;
}
if (levellingManager.isScanning(island)) {
skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
event.setCancelled(true);
return;
}
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
// Check spawn protection
if (configLoad.getBoolean("Island.Spawn.Protection")) {
boolean isObstructing = false;
// Directly on the block
if (LocationUtil.isLocationAffectingIslandSpawn(blockLoc, island, world)) {
isObstructing = true;
}
if (isObstructing) {
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Place.Message"));
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
event.setCancelled(true);
return;
}
}
BlockLimitation limits = skyblock.getLimitationHandler().getInstance(BlockLimitation.class);
long limit = limits.getBlockLimit(player, Material.WATER);
if (limits.isBlockLimitExceeded(event.getItem().getType(), block.getLocation(), limit)) {
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getItem().getType());
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
event.setCancelled(true);
return;
}
if(configLoad.getBoolean("Island.Nether.AllowNetherWater", false)){
event.setCancelled(true);
block.setType(Material.WATER, true);
block.getWorld().playSound(block.getLocation(), Sound.ITEM_BUCKET_EMPTY, 1f, 1f);
if(!event.getPlayer().getGameMode().equals(GameMode.CREATIVE)){
event.getItem().setType(Material.BUCKET);
}
}
}
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {

View File

@ -100,6 +100,7 @@ public class Join implements Listener {
cooldownManager.addCooldownPlayer(CooldownType.Biome, cooldownManager.loadCooldownPlayer(CooldownType.Biome, player)); cooldownManager.addCooldownPlayer(CooldownType.Biome, cooldownManager.loadCooldownPlayer(CooldownType.Biome, player));
cooldownManager.addCooldownPlayer(CooldownType.Creation, cooldownManager.loadCooldownPlayer(CooldownType.Creation, player)); cooldownManager.addCooldownPlayer(CooldownType.Creation, cooldownManager.loadCooldownPlayer(CooldownType.Creation, player));
cooldownManager.addCooldownPlayer(CooldownType.Deletion, cooldownManager.loadCooldownPlayer(CooldownType.Deletion, player));
if (scoreboardManager != null) { if (scoreboardManager != null) {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.listeners;
import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.command.commands.island.TeleportCommand;
import com.songoda.skyblock.config.FileManager; import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.*; import com.songoda.skyblock.island.*;
@ -13,9 +14,9 @@ import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.NMSUtil; import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.world.LocationUtil; import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.world.WorldManager; import com.songoda.skyblock.world.WorldManager;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.Location;
import org.bukkit.attribute.Attribute; import org.bukkit.attribute.Attribute;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -26,6 +27,7 @@ import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import java.io.File; import java.io.File;
import java.util.Objects;
public class Move implements Listener { public class Move implements Listener {
@ -73,15 +75,7 @@ public class Move implements Listener {
Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(playerData.getIsland())); Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(playerData.getIsland()));
if (island != null) { if (island != null) {
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId()) teleportPlayerToIslandSpawn(player, soundManager, island);
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
} else {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
}
player.setFallDistance(0.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
return; return;
} }
@ -116,16 +110,7 @@ public class Move implements Listener {
if (to.getY() <= configLoad.getInt("Island.World." + world.name() + ".Liquid.Height")) { if (to.getY() <= configLoad.getInt("Island.World." + world.name() + ".Liquid.Height")) {
if (keepItemsOnDeath && configLoad.getBoolean("Island.Liquid.Teleport.Enable")) { if (keepItemsOnDeath && configLoad.getBoolean("Island.Liquid.Teleport.Enable")) {
player.setFallDistance(0.0F); player.setFallDistance(0.0F);
teleportPlayerToIslandSpawn(player, soundManager, island);
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
} else {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
}
player.setFallDistance(0.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
} }
return; return;
} }
@ -139,7 +124,7 @@ public class Move implements Listener {
player.setExp(0.0F); player.setExp(0.0F);
if (NMSUtil.getVersionNumber() > 8) { if (NMSUtil.getVersionNumber() > 8) {
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); player.setHealth(Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getValue());
} else { } else {
player.setHealth(player.getMaxHealth()); player.setHealth(player.getMaxHealth());
} }
@ -150,16 +135,10 @@ public class Move implements Listener {
player.removePotionEffect(potionEffect.getType()); player.removePotionEffect(potionEffect.getType());
} }
} }
player.setFallDistance(0.0F); player.setFallDistance(0.0F);
if (configLoad.getBoolean("Island.Void.Teleport.Island")) { if (configLoad.getBoolean("Island.Void.Teleport.Island")) {
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId()) teleportPlayerToIslandSpawn(player, island);
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
} else {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
}
} else { } else {
LocationUtil.teleportPlayerToSpawn(player); LocationUtil.teleportPlayerToSpawn(player);
} }
@ -169,14 +148,16 @@ public class Move implements Listener {
} }
} }
} else { } else {
if (!LocationUtil.isLocationAtLocationRadius(island.getLocation(world, IslandEnvironment.Island), to, island.getRadius() + 0.5)) { if (!LocationUtil.isLocationAtLocationRadius(island.getLocation(world, IslandEnvironment.Island), to, island.getRadius())) {
if (island.getVisit().isVisitor(player.getUniqueId())) { teleportPlayerToIslandSpawn(player, world, island);
player.teleport(island.getLocation(world, IslandEnvironment.Visitor)); Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
} else { FileConfiguration configLoad = config.getFileConfiguration();
player.teleport(island.getLocation(world, IslandEnvironment.Main));
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
} }
player.setFallDistance(0.0F);
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration() messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
.getString("Island.WorldBorder.Outside.Message")); .getString("Island.WorldBorder.Outside.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
@ -204,6 +185,50 @@ public class Move implements Listener {
} }
} }
private void teleportPlayerToIslandSpawn(Player player, IslandWorld world, Island island) {
Location loc;
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
loc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Main));
} else {
loc = island.getLocation(world, IslandEnvironment.Main);
LocationUtil.removeWaterFromLoc(skyblock, loc);
}
} else {
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
loc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Visitor));
} else {
loc = island.getLocation(world, IslandEnvironment.Visitor);
}
}
if(loc != null){
player.teleport(loc);
} else {
LocationUtil.teleportPlayerToSpawn(player);
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
Objects.requireNonNull(skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Command.Island.Teleport.Unsafe.Message"))));
}
}
private void teleportPlayerToIslandSpawn(Player player, Island island) {
this.teleportPlayerToIslandSpawn(player, IslandWorld.Normal, island);
}
private void teleportPlayerToIslandSpawn(Player player, SoundManager soundManager, Island island) {
teleportPlayerToIslandSpawn(player, island);
FileManager fileManager = skyblock.getFileManager();
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onTeleport(PlayerTeleportEvent e) { public void onTeleport(PlayerTeleportEvent e) {

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.listeners;
import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.utils.LocationUtils;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager; import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.config.FileManager.Config;
@ -15,6 +16,7 @@ import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.world.LocationUtil; import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.world.WorldManager; import com.songoda.skyblock.world.WorldManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -131,21 +133,13 @@ public class Portal implements Listener {
switch (toWorld) { switch (toWorld) {
case Nether: case Nether:
if (configLoad.getBoolean("Island.World.Nether.Enable") && island.isRegionUnlocked(player, "Nether")) { if (configLoad.getBoolean("Island.World.Nether.Enable") && island.isRegionUnlocked(player, "Nether")) {
IslandWorld toWorldF = toWorld; teleportPlayerToWorld(player, soundManager, island, spawnEnvironment, tick, 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; break;
case End: case End:
if (configLoad.getBoolean("Island.World.End.Enable") && island.isRegionUnlocked(player, "End")) { if (configLoad.getBoolean("Island.World.End.Enable") && island.isRegionUnlocked(player, "End")) {
IslandWorld toWorldF = toWorld; teleportPlayerToWorld(player, soundManager, island, spawnEnvironment, tick, 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; break;
@ -160,6 +154,21 @@ public class Portal implements Listener {
} }
private void teleportPlayerToWorld(Player player, SoundManager soundManager, Island island, IslandEnvironment spawnEnvironment, Tick tick, IslandWorld toWorld) {
IslandWorld toWorldF = toWorld;
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> {
Location loc = island.getLocation(toWorldF, spawnEnvironment);
Location safeLoc = LocationUtil.getSafeLocation(loc);
if(safeLoc != null){
loc = safeLoc;
}
player.teleport(loc);
}, 1L);
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
player.setFallDistance(0.0F);
tick.setTick(1);
}
public static class Tick { public static class Tick {
private int tick = 1; private int tick = 1;
private long last = System.currentTimeMillis() - 1001; private long last = System.currentTimeMillis() - 1001;

View File

@ -2,6 +2,8 @@ package com.songoda.skyblock.listeners;
import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.challenge.challenge.ChallengeManager;
import com.songoda.skyblock.challenge.player.PlayerManager;
import com.songoda.skyblock.cooldown.CooldownManager; import com.songoda.skyblock.cooldown.CooldownManager;
import com.songoda.skyblock.cooldown.CooldownType; import com.songoda.skyblock.cooldown.CooldownType;
import com.songoda.skyblock.invite.Invite; import com.songoda.skyblock.invite.Invite;
@ -44,6 +46,7 @@ public class Quit implements Listener {
MessageManager messageManager = skyblock.getMessageManager(); MessageManager messageManager = skyblock.getMessageManager();
InviteManager inviteManager = skyblock.getInviteManager(); InviteManager inviteManager = skyblock.getInviteManager();
IslandManager islandManager = skyblock.getIslandManager(); IslandManager islandManager = skyblock.getIslandManager();
PlayerManager challengePlayerManager = skyblock.getFabledChallenge().getPlayerManager();
PlayerData playerData = playerDataManager.getPlayerData(player); PlayerData playerData = playerDataManager.getPlayerData(player);
@ -91,9 +94,42 @@ public class Quit implements Listener {
cooldownManager.setCooldownPlayer(CooldownType.Creation, player); cooldownManager.setCooldownPlayer(CooldownType.Creation, player);
cooldownManager.removeCooldownPlayer(CooldownType.Creation, player); cooldownManager.removeCooldownPlayer(CooldownType.Creation, player);
cooldownManager.setCooldownPlayer(CooldownType.Deletion, player);
cooldownManager.removeCooldownPlayer(CooldownType.Deletion, player);
playerDataManager.savePlayerData(player); playerDataManager.savePlayerData(player);
playerDataManager.unloadPlayerData(player); playerDataManager.unloadPlayerData(player);
boolean offline = true;
if(island != null && skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.PerIsland", false)){
if(island.getRole(IslandRole.Member) != null){
for(UUID uuid : island.getRole(IslandRole.Member)){
if(Bukkit.getPlayer(uuid) != null && !Bukkit.getPlayer(uuid).isOnline()){
offline = false;
}
}
}
if(offline && island.getRole(IslandRole.Operator) != null){
for(UUID uuid : island.getRole(IslandRole.Operator)){
if(Bukkit.getPlayer(uuid) != null && !Bukkit.getPlayer(uuid).isOnline()){
offline = false;
}
}
}
if(offline && island.getRole(IslandRole.Owner) != null){
for(UUID uuid : island.getRole(IslandRole.Owner)){
if(Bukkit.getPlayer(uuid) != null && !Bukkit.getPlayer(uuid).isOnline()){
offline = false;
}
}
}
}
if(offline){
challengePlayerManager.unloadPlayer(player.getUniqueId());
}
for (Island islandList : islandManager.getCoopIslands(player)) { for (Island islandList : islandManager.getCoopIslands(player)) {
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration() if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Coop.Unload") || islandList.getCoopType(player.getUniqueId()) == IslandCoop.TEMP) { .getBoolean("Island.Coop.Unload") || islandList.getCoopType(player.getUniqueId()) == IslandCoop.TEMP) {
@ -129,6 +165,6 @@ public class Quit implements Listener {
} }
}); });
// Unload Challenge // Unload Challenge
SkyBlock.getInstance().getFabledChallenge().getPlayerManager().loadPlayer(event.getPlayer().getUniqueId()); SkyBlock.getInstance().getFabledChallenge().getPlayerManager().unloadPlayer(event.getPlayer().getUniqueId());
} }
} }

View File

@ -165,54 +165,67 @@ public class Border {
configLoad.getStringList("Menu.Border.Item.Toggle.Lore"), configLoad.getStringList("Menu.Border.Item.Toggle.Lore"),
new Placeholder[]{new Placeholder("%toggle", borderToggle)}, null, null), 1); new Placeholder[]{new Placeholder("%toggle", borderToggle)}, null, null), 1);
if (borderColor == WorldBorder.Color.Blue) { if(player.hasPermission("fabledskyblock.island.border.blue")){
nInv.addItem(nInv.createItem(CompatibleMaterial.LIGHT_BLUE_DYE.getItem(), if (borderColor == WorldBorder.Color.Blue) {
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", nInv.addItem(nInv.createItem(CompatibleMaterial.LIGHT_BLUE_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Word.Blue")), configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"), configLoad.getString("Menu.Border.Item.Word.Blue")),
new Placeholder[]{new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Blue"))}, configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
null, null), 2); new Placeholder[]{new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Blue"))},
null, null), 2);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.LIGHT_BLUE_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Blue")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
new Placeholder[]{new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Blue"))},
null, null), 2);
}
} else { } else {
nInv.addItem(nInv.createItem(CompatibleMaterial.LIGHT_BLUE_DYE.getItem(), nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", "", null, null, null, null), 2);
configLoad.getString("Menu.Border.Item.Word.Blue")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
new Placeholder[]{new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Blue"))},
null, null), 2);
} }
if(player.hasPermission("fabledskyblock.island.border.green")){
if (borderColor == WorldBorder.Color.Green) { if (borderColor == WorldBorder.Color.Green) {
nInv.addItem(nInv.createItem(CompatibleMaterial.LIME_DYE.getItem(), nInv.addItem(nInv.createItem(CompatibleMaterial.LIME_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Green")), configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"), configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
new Placeholder[]{ new Placeholder[]{
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Green"))}, new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Green"))},
null, null), 3); null, null), 3);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.LIME_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
new Placeholder[]{
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Green"))},
null, null), 3);
}
} else { } else {
nInv.addItem(nInv.createItem(CompatibleMaterial.LIME_DYE.getItem(), nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", "", null, null, null, null), 3);
configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
new Placeholder[]{
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Green"))},
null, null), 3);
} }
if(player.hasPermission("fabledskyblock.island.border.red")){
if (borderColor == WorldBorder.Color.Red) { if (borderColor == WorldBorder.Color.Red) {
nInv.addItem(nInv.createItem(CompatibleMaterial.RED_DYE.getItem(), nInv.addItem(nInv.createItem(CompatibleMaterial.RED_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Red")), configLoad.getString("Menu.Border.Item.Word.Red")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"), configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
new Placeholder[]{new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Red"))}, new Placeholder[]{new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Red"))},
null, null), 4); null, null), 4);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.RED_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Red")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
new Placeholder[]{new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Red"))},
null, null), 4);
}
} else { } else {
nInv.addItem(nInv.createItem(CompatibleMaterial.RED_DYE.getItem(), nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color", "", null, null, null, null), 4);
configLoad.getString("Menu.Border.Item.Word.Red")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
new Placeholder[]{new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Red"))},
null, null), 4);
} }
nInv.setTitle(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Border.Title"))); nInv.setTitle(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Border.Title")));

View File

@ -93,34 +93,85 @@ public final class ControlPanel {
}); });
// Teleport to island and open/close island // Teleport to island and open/close island
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_DOOR.getItem(), configLoad.getString("Menu.ControlPanel.Item.Teleport.Displayname"), if(player.hasPermission("fabledskyblock.island.teleport")){
configLoad.getStringList("Menu.ControlPanel.Item.Teleport.Lore"), null, null, null), 1); nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_DOOR.getItem(), configLoad.getString("Menu.ControlPanel.Item.Teleport.Displayname"),
nInv.addItem(nInv.createItem(CompatibleMaterial.IRON_DOOR.getItem(), configLoad.getString("Menu.ControlPanel.Item.Lock.Displayname"), configLoad.getStringList("Menu.ControlPanel.Item.Teleport.Lore"), null, null, null), 1);
configLoad.getStringList("Menu.ControlPanel.Item.Lock.Lore"), null, null, null), 10); } else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 1);
}
if(player.hasPermission("fabledskyblock.island.close")){
nInv.addItem(nInv.createItem(CompatibleMaterial.IRON_DOOR.getItem(), configLoad.getString("Menu.ControlPanel.Item.Lock.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Lock.Lore"), null, null, null), 10);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 10);
}
// Glass panes barriers // Glass panes barriers
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(), configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 0, 2, 5, 8, nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(), configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 0, 2, 5, 8,
9, 11, 14, 17); 9, 11, 14, 17);
// 4 Items at the left // 4 Items at the left
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.EXPERIENCE_BOTTLE.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Level.Displayname"), if(player.hasPermission("fabledskyblock.island.level")){
configLoad.getStringList("Menu.ControlPanel.Item.Level.Lore"), null, null, null), 3); nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.EXPERIENCE_BOTTLE.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Level.Displayname"),
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG), configLoad.getString("Menu.ControlPanel.Item.Settings.Displayname"), configLoad.getStringList("Menu.ControlPanel.Item.Level.Lore"), null, null, null), 3);
configLoad.getStringList("Menu.ControlPanel.Item.Settings.Lore"), null, null, null), 4); } else {
nInv.addItem(nInv.createItem(CompatibleMaterial.CLOCK.getItem(), configLoad.getString("Menu.ControlPanel.Item.Weather.Displayname"), nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getStringList("Menu.ControlPanel.Item.Weather.Lore"), null, null, null), 12); configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 3);
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(), configLoad.getString("Menu.ControlPanel.Item.Biome.Displayname"), }
configLoad.getStringList("Menu.ControlPanel.Item.Biome.Lore"), null, null, null), 13); if(player.hasPermission("fabledskyblock.island.settings")){
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG), configLoad.getString("Menu.ControlPanel.Item.Settings.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Settings.Lore"), null, null, null), 4);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 4);
}
if(player.hasPermission("fabledskyblock.island.weather")){
nInv.addItem(nInv.createItem(CompatibleMaterial.CLOCK.getItem(), configLoad.getString("Menu.ControlPanel.Item.Weather.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Weather.Lore"), null, null, null), 12);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 12);
}
if(player.hasPermission("fabledskyblock.island.biome")){
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(), configLoad.getString("Menu.ControlPanel.Item.Biome.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Biome.Lore"), null, null, null), 13);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 13);
}
// 4 Items at the right // 4 Items at the right
nInv.addItem(nInv.createItem(new ItemStack(Material.ITEM_FRAME), configLoad.getString("Menu.ControlPanel.Item.Members.Displayname"), if(player.hasPermission("fabledskyblock.island.members")){
configLoad.getStringList("Menu.ControlPanel.Item.Members.Lore"), null, null, null), 16); nInv.addItem(nInv.createItem(new ItemStack(Material.ITEM_FRAME), configLoad.getString("Menu.ControlPanel.Item.Members.Displayname"),
nInv.addItem(nInv.createItem(new ItemStack(Material.IRON_AXE), configLoad.getString("Menu.ControlPanel.Item.Bans.Displayname"), configLoad.getStringList("Menu.ControlPanel.Item.Members.Lore"), null, null, null), 16);
configLoad.getStringList("Menu.ControlPanel.Item.Bans.Lore"), null, null, new ItemFlag[] { ItemFlag.HIDE_ATTRIBUTES }), 6); } else {
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Visitors.Displayname"), nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getStringList("Menu.ControlPanel.Item.Visitors.Lore"), null, null, null), 7); configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 16);
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.ANVIL.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Upgrades.Displayname"), }
configLoad.getStringList("Menu.ControlPanel.Item.Upgrades.Lore"), null, null, null), 15); if(player.hasPermission("fabledskyblock.island.bans")){
nInv.addItem(nInv.createItem(new ItemStack(Material.IRON_AXE), configLoad.getString("Menu.ControlPanel.Item.Bans.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Bans.Lore"), null, null, new ItemFlag[] { ItemFlag.HIDE_ATTRIBUTES }), 6);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 6);
}
if(player.hasPermission("fabledskyblock.island.visitors")){
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Visitors.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Visitors.Lore"), null, null, null), 7);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 7);
}
if(player.hasPermission("fabledskyblock.island.upgrade")){
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.ANVIL.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Upgrades.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Upgrades.Lore"), null, null, null), 15);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 15);
}
nInv.setTitle(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.ControlPanel.Title"))); nInv.setTitle(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.ControlPanel.Title")));
nInv.setRows(2); nInv.setRows(2);

View File

@ -109,16 +109,22 @@ public class Leaderboard {
new Placeholder[]{new Placeholder("%leaderboard", Viewer.Type.Level.name())}, null, new Placeholder[]{new Placeholder("%leaderboard", Viewer.Type.Level.name())}, null,
null), null),
1); 1);
nInv.addItem(
nInv.createItem(new ItemStack(Material.GOLD_INGOT), configLoad if(fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.Enable")){
.getString( nInv.addItem(
"Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Displayname") nInv.createItem(new ItemStack(Material.GOLD_INGOT), configLoad
.replace("%leaderboard", Viewer.Type.Bank.name()), .getString(
configLoad.getStringList( "Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Displayname")
"Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Lore"), .replace("%leaderboard", Viewer.Type.Bank.name()),
new Placeholder[]{new Placeholder("%leaderboard", Viewer.Type.Bank.name())}, null, configLoad.getStringList(
null), "Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Lore"),
2); new Placeholder[]{new Placeholder("%leaderboard", Viewer.Type.Bank.name())}, null,
null),
2);
} else {
nInv.addItem(
nInv.createItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), "", null, null, null, null), 2);
}
nInv.addItem( nInv.addItem(
nInv.createItem(new ItemStack(Material.EMERALD), configLoad nInv.createItem(new ItemStack(Material.EMERALD), configLoad
.getString( .getString(

View File

@ -134,7 +134,7 @@ public class Visitors {
Bukkit.getServer().dispatchCommand(player, "island kick " + playerName); Bukkit.getServer().dispatchCommand(player, "island kick " + playerName);
} }
} else { } else {
if (banningEnabled && ((isOperator && canBan) || isOwner)) { if (banningEnabled && ((isOperator && canBan))) {
Bukkit.getServer().dispatchCommand(player, "island ban " + playerName); Bukkit.getServer().dispatchCommand(player, "island ban " + playerName);
} else { } else {
soundManager.playSound(player, CompatibleSound.ENTITY_CHICKEN_EGG.getSound(), 1.0F, soundManager.playSound(player, CompatibleSound.ENTITY_CHICKEN_EGG.getSound(), 1.0F,
@ -159,24 +159,28 @@ public class Visitors {
Set<UUID> islandVisitors = islandManager.getVisitorsAtIsland(island); Set<UUID> islandVisitors = islandManager.getVisitorsAtIsland(island);
Map<Integer, UUID> sortedIslandVisitors = new TreeMap<>(); Map<Integer, UUID> sortedIslandVisitors = new TreeMap<>();
for (UUID islandVisitorList : islandVisitors) {
Player targetPlayer = Bukkit.getPlayer(islandVisitorList);
if(targetPlayer != null && player.canSee(targetPlayer)){ // Remove vanished players
sortedIslandVisitors.put(
playerDataManager.getPlayerData(targetPlayer).getVisitTime(),
islandVisitorList);
}
}
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(), nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Visitors.Item.Exit.Displayname"), null, null, null, null), 0, 8); configLoad.getString("Menu.Visitors.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem( nInv.addItem(
nInv.createItem(new ItemStack(Material.PAINTING), nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Visitors.Item.Statistics.Displayname"), configLoad.getString("Menu.Visitors.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Visitors.Item.Statistics.Lore"), configLoad.getStringList("Menu.Visitors.Item.Statistics.Lore"),
new Placeholder[]{new Placeholder("%visitors", "" + islandVisitors.size())}, null, null), new Placeholder[]{new Placeholder("%visitors", "" + sortedIslandVisitors.size())}, null, null),
4); 4);
nInv.addItem( nInv.addItem(
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(), nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Visitors.Item.Barrier.Displayname"), null, null, null, null), configLoad.getString("Menu.Visitors.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17); 9, 10, 11, 12, 13, 14, 15, 16, 17);
for (UUID islandVisitorList : islandVisitors) {
sortedIslandVisitors.put(
playerDataManager.getPlayerData(Bukkit.getServer().getPlayer(islandVisitorList)).getVisitTime(),
islandVisitorList);
}
islandVisitors.clear(); islandVisitors.clear();

View File

@ -7,6 +7,7 @@ import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.generator.GeneratorManager; import com.songoda.skyblock.generator.GeneratorManager;
import com.songoda.skyblock.generator.GeneratorMaterial; import com.songoda.skyblock.generator.GeneratorMaterial;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.message.MessageManager; import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.placeholder.Placeholder; import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.playerdata.PlayerData; import com.songoda.skyblock.playerdata.PlayerData;
@ -277,7 +278,7 @@ public class Generator implements Listener {
configLoad.getString("Island.Admin.Generator.Characters.Message")); configLoad.getString("Island.Admin.Generator.Characters.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else { } else {
generatorManager.addGenerator(event1.getName(), new ArrayList<>(), false); generatorManager.addGenerator(event1.getName(), IslandWorld.Normal, new ArrayList<>(), false);
messageManager.sendMessage(player, messageManager.sendMessage(player,
configLoad.getString("Island.Admin.Generator.Created.Message") configLoad.getString("Island.Admin.Generator.Created.Message")

View File

@ -26,86 +26,84 @@ public class PermissionManager {
public PermissionManager(SkyBlock plugin) { public PermissionManager(SkyBlock plugin) {
this.plugin = plugin; this.plugin = plugin;
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> { // Load default permissions.
// Load default permissions. registerPermissions(
registerPermissions( //Listening
//Listening new StoragePermission(plugin),
new StoragePermission(plugin), new DragonEggUsePermission(plugin),
new DragonEggUsePermission(plugin), new BeaconPermission(plugin),
new BeaconPermission(plugin), new ProjectilePermission(plugin),
new ProjectilePermission(plugin), new DestroyPermission(plugin),
new DestroyPermission(plugin), new AnvilPermission(plugin),
new AnvilPermission(plugin), new BedPermission(plugin),
new BedPermission(plugin), new BrewingPermission(plugin),
new BrewingPermission(plugin), new WorkbenchPermission(plugin),
new WorkbenchPermission(plugin), new DoorPermission(plugin),
new DoorPermission(plugin), new EnchantPermission(plugin),
new EnchantPermission(plugin), new FurnacePermission(plugin),
new FurnacePermission(plugin), new LeverButtonPermission(plugin),
new LeverButtonPermission(plugin), new JukeboxPermission(plugin),
new JukeboxPermission(plugin), new HopperPermission(plugin),
new HopperPermission(plugin), new NoteblockPermission(plugin),
new NoteblockPermission(plugin), new RedstonePermission(plugin),
new RedstonePermission(plugin), new GatePermission(plugin),
new GatePermission(plugin), new DropperDispenserPermission(plugin),
new DropperDispenserPermission(plugin), new BucketPermission(plugin),
new BucketPermission(plugin), new WaterCollectionPermission(plugin),
new WaterCollectionPermission(plugin), new SpawnEggPermission(plugin),
new SpawnEggPermission(plugin), new EntityPlacementPermission(plugin),
new EntityPlacementPermission(plugin), new FirePermission(plugin),
new FirePermission(plugin), new TramplePermission(plugin),
new TramplePermission(plugin), new PressurePlatePermission(plugin),
new PressurePlatePermission(plugin), new CakePermission(plugin),
new CakePermission(plugin), new PlacePermission(plugin),
new PlacePermission(plugin), new LeashPermission(plugin),
new LeashPermission(plugin), new AnimalBreedingPermission(plugin),
new AnimalBreedingPermission(plugin), new MinecartPermission(plugin),
new MinecartPermission(plugin), new BoatPermission(plugin),
new BoatPermission(plugin), new TradingPermission(plugin),
new TradingPermission(plugin), new MilkingPermission(plugin),
new MilkingPermission(plugin), new ShearingPermission(plugin),
new ShearingPermission(plugin), new MobRidingPermission(plugin),
new MobRidingPermission(plugin), new HorseInventoryPermission(plugin),
new HorseInventoryPermission(plugin), new MobHurtingPermission(plugin),
new MobHurtingPermission(plugin), new ArmorStandUsePermission(plugin),
new ArmorStandUsePermission(plugin), new MonsterHurtingPermission(plugin),
new MonsterHurtingPermission(plugin), new PvpPermission(plugin),
new PvpPermission(plugin), new HangingDestroyPermission(plugin),
new HangingDestroyPermission(plugin), new DamagePermission(plugin),
new DamagePermission(plugin), new ExplosionsPermission(plugin),
new ExplosionsPermission(plugin), new MobTamingPermission(plugin),
new MobTamingPermission(plugin), new MobGriefingPermission(plugin),
new MobGriefingPermission(plugin), new ExperienceOrbPickupPermission(plugin),
new ExperienceOrbPickupPermission(plugin), new NaturalMobSpawningPermission(),
new NaturalMobSpawningPermission(), new HungerPermission(plugin),
new HungerPermission(plugin), new PortalPermission(plugin),
new PortalPermission(plugin), new ItemPickupPermission(),
new ItemPickupPermission(), new ItemDropPermission(),
new ItemDropPermission(), new FishingPermission(plugin),
new FishingPermission(plugin),
// Basic // Basic
new MemberPermission(), new MemberPermission(),
new VisitorPermission(), new VisitorPermission(),
new KickPermission(), new KickPermission(),
new BiomePermission(), new BiomePermission(),
new KeepItemsOnDeathPermission(), new KeepItemsOnDeathPermission(),
new UnbanPermission(), new UnbanPermission(),
new BanPermission(), new BanPermission(),
new BorderPermission(), new BorderPermission(),
new FireSpreadPermission(), new FireSpreadPermission(),
new CoopPlayersPermission(), new CoopPlayersPermission(),
new IslandPermission(), new IslandPermission(),
new LeafDecayPermission(), new LeafDecayPermission(),
new WeatherPermission(), new WeatherPermission(),
new MainSpawnPermission(), new MainSpawnPermission(),
new VisitorSpawnPermission()); new VisitorSpawnPermission());
registeredHandlers = registeredHandlers.stream().sorted(Comparator.comparingInt(h -> { registeredHandlers = registeredHandlers.stream().sorted(Comparator.comparingInt(h -> {
final PermissionHandler permissionHandler = h.getHandler().getAnnotation(PermissionHandler.class); final PermissionHandler permissionHandler = h.getHandler().getAnnotation(PermissionHandler.class);
return permissionHandler.priority().ordinal(); return permissionHandler.priority().ordinal();
})).collect(Collectors.toList()); })).collect(Collectors.toList());
}, 20L);
} }
public boolean registerPermission(BasicPermission permission) { public boolean registerPermission(BasicPermission permission) {

View File

@ -0,0 +1,87 @@
package com.songoda.skyblock.tasks;
import com.songoda.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.hologram.Hologram;
import com.songoda.skyblock.hologram.HologramType;
import com.songoda.skyblock.island.IslandLevel;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.leaderboard.Leaderboard;
import com.songoda.skyblock.leaderboard.LeaderboardManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.visit.Visit;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class MobNetherWaterTask extends BukkitRunnable {
private static MobNetherWaterTask instance;
private static SkyBlock plugin;
public MobNetherWaterTask(SkyBlock plug) {
plugin = plug;
}
public static MobNetherWaterTask startTask(SkyBlock plug) {
plugin = plug;
if (instance == null) {
instance = new MobNetherWaterTask(plugin);
instance.runTaskTimer(plugin, 0, 2L);
}
return instance;
}
@Override
public void run() {
FileManager fileManager = plugin.getFileManager();
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Nether.WaterDisappearWithNetherMobs", false)){
for(World world : Bukkit.getServer().getWorlds()){
if(plugin.getWorldManager().isIslandWorld(world) && plugin.getWorldManager().getIslandWorld(world).equals(IslandWorld.Nether)){
for(Entity ent : world.getEntities()){
switch(ent.getType()){
case PIG_ZOMBIE:
case BLAZE:
case MAGMA_CUBE:
case WITHER_SKELETON:
case WITHER:
case GHAST:
Block block = ent.getLocation().getBlock();
if(block.getType().equals(Material.WATER)){
block.setType(Material.AIR, true);
world.playSound(block.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f);
world.playEffect(block.getLocation(), Effect.SMOKE, 1);
}
block = block.getRelative(BlockFace.UP);
if(block.getType().equals(Material.WATER)){
block.setType(Material.AIR, true);
world.playSound(block.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f);
world.playEffect(block.getLocation(), Effect.SMOKE, 1);
}
default:
break;
}
}
}
}
}
}
public void onDisable() {
}
}

View File

@ -15,6 +15,7 @@ import org.bukkit.*;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.io.File; import java.io.File;
@ -25,6 +26,100 @@ import java.util.logging.Level;
public final class LocationUtil { public final class LocationUtil {
public static void removeWaterFromLoc(SkyBlock plugin, Location loc) {
if(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Teleport.RemoveWater", false)){
Location tempLoc = LocationUtil.getDefinitiveLocation(loc);
if(tempLoc.getBlock().getType().equals(Material.WATER)){
tempLoc.getBlock().setType(Material.AIR);
} else if(tempLoc.getBlock().getBlockData() instanceof Waterlogged){
Waterlogged blockData = (Waterlogged) tempLoc.getBlock().getBlockData();
blockData.setWaterlogged(false);
tempLoc.getBlock().setBlockData(blockData);
}
}
}
public static 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);
found = checkBlock(locChecked);
}
}
if (found) {
locChecked = locChecked.add(0d,1d,0d);
} else {
locChecked = null;
}
return locChecked;
}
public static Location getDefinitiveLocation(Location loc){
Location locWorking = loc.clone();
for(int i=locWorking.getBlockY(); i>=0; i--){
if(!locWorking.getBlock().isEmpty()){
if(locWorking.getBlock().getType().equals(Material.WATER) || locWorking.getBlock().getBlockData() instanceof Waterlogged){
loc = locWorking;
}
break;
}
}
return loc;
}
private static boolean checkBlock(Location locChecked) {
boolean safe = false;
if(!locChecked.getBlock().isEmpty() &&
!locChecked.getBlock().isLiquid() &&
!locChecked.getBlock().isPassable() &&
locChecked.getBlock().getType().isSolid() &&
locChecked.getBlock().getType().isBlock() &&
locChecked.add(0d,1d,0d).getBlock().getType().isAir() &&
locChecked.add(0d,2d,0d).getBlock().getType().isAir() &&
!(locChecked.getBlock().getBlockData() instanceof Waterlogged)){
safe = true;
switch(locChecked.getBlock().getType()){
case ACACIA_BUTTON:
case ACACIA_DOOR:
case ACACIA_FENCE_GATE:
case ACACIA_TRAPDOOR:
case BIRCH_DOOR:
case BIRCH_FENCE_GATE:
case BIRCH_TRAPDOOR:
case CACTUS:
case CAKE:
case CAMPFIRE:
case COBWEB:
case DARK_OAK_DOOR:
case DARK_OAK_FENCE_GATE:
case DARK_OAK_TRAPDOOR:
case IRON_TRAPDOOR:
case JUNGLE_DOOR:
case JUNGLE_FENCE_GATE:
case JUNGLE_TRAPDOOR:
case LADDER:
case MAGMA_BLOCK:
case NETHER_PORTAL:
case OAK_DOOR:
case OAK_FENCE_GATE:
case SPRUCE_DOOR:
case SPRUCE_FENCE_GATE:
safe = false;
break;
}
}
return safe;
}
public static boolean isLocationLocation(Location location1, Location location2) { public static boolean isLocationLocation(Location location1, Location location2) {
return location1.getBlockX() == location2.getBlockX() && location1.getBlockY() == location2.getBlockY() && location1.getBlockZ() == location2.getBlockZ(); return location1.getBlockX() == location2.getBlockX() && location1.getBlockY() == location2.getBlockY() && location1.getBlockZ() == location2.getBlockZ();
} }

View File

@ -32,10 +32,25 @@ Island:
# When enabled cooldown will start when a player deletes their Island. # When enabled cooldown will start when a player deletes their Island.
Deletion: Deletion:
Enable: true Enable: true
# Time until player can create another island. # Time in seconds until player can create another island.
Time: 60 Time: 60
# [!] How many seconds to wait before teleporting to a newly created island # [!] How many seconds to wait before teleporting to a newly created island
TeleportTimeout: 1 TeleportTimeout: 1
# The distance between the islands
Distance: 1200
Deletion:
# [!] You are adviced to keep these options both enabled to prevent any issues.
Cooldown:
# When enabled cooldown will start when a player creates an Island.
Creation:
Enable: true
# When enabled cooldown will start when a player deletes their Island.
Deletion:
Enable: true
# Time in seconds until player can delete their island.
Time: 60
ClearInventory: false
ClearEnderChest: false
World: World:
# Delete the Island world when changing the liquid option. # Delete the Island world when changing the liquid option.
# If lava disabled, the world will be a water world. # If lava disabled, the world will be a water world.
@ -87,6 +102,8 @@ Island:
# Prevent blocks being placed that would go outside of the Island border # Prevent blocks being placed that would go outside of the Island border
# Pistons | Dispensers | Liquid Flow # Pistons | Dispensers | Liquid Flow
Block: true Block: true
# Enabled/Disabled by default
Default: false
Spawn: Spawn:
# Prevents blocks being placed inside the location where players spawn on # Prevents blocks being placed inside the location where players spawn on
# an Island. When setting the spawn points, this option when enabled will # an Island. When setting the spawn points, this option when enabled will
@ -191,6 +208,8 @@ Island:
IncludeEmptyPointsInList: true IncludeEmptyPointsInList: true
# Island Level Points divided by value # Island Level Points divided by value
Division: 100 Division: 100
# Points to subtract to Island Level Points
Subtract: 1000
Cooldown: Cooldown:
# Time until Island level rescan expires # Time until Island level rescan expires
Time: 60 Time: 60
@ -308,3 +327,54 @@ Island:
Challenge: Challenge:
# Enable or disable challenges. Configuration for challenges are in challenges.yml file # Enable or disable challenges. Configuration for challenges are in challenges.yml file
Enable: true Enable: true
# Disabling this will make challenges per player
PerIsland: true
Teleport:
# Enable or disable Fall damage
FallDamage: true
RemoveWater: true
Limits:
# Should slime split bypass limits.yml
AllowSlimeSplit: true
Nether:
AllowNetherWater: false
WaterDisappearWithNetherMobs: false
WaterDoNotFlowNearNetherMobs: false
BlazeImmuneToWaterInNether: false
Restrict:
NetherBlocks:
NETHERRACK: true
SOUL_SAND: true
GLOWSTONE: true
NETHER_BRICKS: true
NETHER_BRICK_STAIRS: true
NETHER_BRICK_SLAB: true
NETHER_QUARTZ_ORE: true
QUARTZ_BLOCK: true
QUARTZ_PILLAR: true
CHISELED_QUARTZ_BLOCK: true
QUARTZ_STAIRS: true
NETHER_BRICK_WALL: true
NETHER_BRICK_FENCE: true
RED_NETHER_BRICKS: true
RED_NETHER_BRICK_STAIRS: true
RED_NETHER_BRICK_SLAB: true
RED_NETHER_BRICK_WALL: true
NETHER_WART: true
NETHER_WART_BLOCK: true
WITHER_SKELETON_SKULL: true
WITHER_ROSE: true
EndBlocks:
END_STONE: true
END_STONE_BRICKS: true
END_STONE_BRICK_WALL: true
END_STONE_BRICK_STAIRS: true
END_STONE_BRICK_SLAB: true
PURPUR_BLOCK: true
PURPUR_SLAB: true
PURPUR_PILLAR: true
PURPUR_STAIRS: true
END_ROD: true
END_CRYSTAL: true
CHORUS_FLOWER: true
CHORUS_PLANT: true

View File

@ -1,6 +1,7 @@
Generators: Generators:
Default: Normal:
Name: Default Name: Normal
World: Normal
Permission: false Permission: false
Materials: Materials:
COBBLESTONE: COBBLESTONE:
@ -14,4 +15,22 @@ Generators:
EMERALD_ORE: EMERALD_ORE:
Chance: 5.5 Chance: 5.5
DIAMOND_ORE: DIAMOND_ORE:
Chance: 2.5 Chance: 2.5
Nether:
Name: Nether
World: Nether
Permission: false
Materials:
NETHERRACK:
Chance: 80
GLOWSTONE:
Chance: 10.0
QUARTZ_ORE:
Chance: 10.0
End:
Name: End
World: End
Permission: false
Materials:
END_STONE:
Chance: 100.0

View File

@ -905,6 +905,8 @@ Command:
Message: '&bSkyBlock &8| &aInfo&8: &eYou have been teleported to your Island.' Message: '&bSkyBlock &8| &aInfo&8: &eYou have been teleported to your Island.'
Other: Other:
Message: '&bSkyBlock &8| &aInfo&8: &eYou have been teleported to &a%player''s &eIsland.' Message: '&bSkyBlock &8| &aInfo&8: &eYou have been teleported to &a%player''s &eIsland.'
Unsafe:
Message: '&bSkyBlock &8| &cError&8: &eNo safe position found'
Create: Create:
Owner: Owner:
Message: '&bSkyBlock &8| &cError&8: &eYou are already an Island Owner.' Message: '&bSkyBlock &8| &cError&8: &eYou are already an Island Owner.'
@ -988,6 +990,8 @@ Command:
Message: '&bSkyBlock &8| &cError&8: &eCategory not found.' Message: '&bSkyBlock &8| &cError&8: &eCategory not found.'
ChallengeNotFound: ChallengeNotFound:
Message: '&bSkyBlock &8| &cError&8: &eChallenge not found.' Message: '&bSkyBlock &8| &cError&8: &eChallenge not found.'
NoIsland:
Message: '&bSkyBlock &8| &cError&8: &eYou don''t have an island.'
Preview: Preview:
Info: Info:
Message: '&f&oAllows you to preview island before choosing' Message: '&f&oAllows you to preview island before choosing'
@ -3462,6 +3466,12 @@ Island:
Message: '&bSkyBlock &8| &cError&8: &eThat Structure does not exist.' Message: '&bSkyBlock &8| &cError&8: &eThat Structure does not exist.'
File: File:
Message: '&bSkyBlock &8| &cError&8: &eThat file does not exist in the Structures directory.' Message: '&bSkyBlock &8| &cError&8: &eThat file does not exist in the Structures directory.'
Deletion:
Cooldown:
Word:
Minute: minute(s)
Second: second(s)
Message: '&bSkyBlock &8| &cError&8: &eYou must wait &c&o%time &ebefore deleting an Island.'
Creator: Creator:
Selector: Selector:
Created: Created:
@ -3578,6 +3588,10 @@ Island:
Message: '&bSkyBlock &8| &cError&8: &eYou need to pay to unlock the Nether. To do that use &7/island unlock nether&e This will cost ''&7$%cost%&e''.' Message: '&bSkyBlock &8| &cError&8: &eYou need to pay to unlock the Nether. To do that use &7/island unlock nether&e This will cost ''&7$%cost%&e''.'
End: End:
Message: '&bSkyBlock &8| &cError&8: &eYou need to pay to unlock The End. To do that use &7/island unlock end&e This will cost ''&7$%cost%&e''.' Message: '&bSkyBlock &8| &cError&8: &eYou need to pay to unlock The End. To do that use &7/island unlock end&e This will cost ''&7$%cost%&e''.'
NetherBlocksPlace:
Message: '&bSkyBlock &8| &cError&8: &eYou need to pay to unlock the Nether in order to place this block.'
EndBlocksPlace:
Message: '&bSkyBlock &8| &cError&8: &eYou need to pay to unlock The End in order to place this block.'
Settings: Settings:
Visitor: Visitor:
Welcome: Welcome:

View File

@ -4,6 +4,7 @@ version: maven-version-number
api-version: 1.13 api-version: 1.13
description: A unique SkyBlock plugin description: A unique SkyBlock plugin
author: Songoda 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]
loadbefore: [Multiverse-Core, ProtocolLib] loadbefore: [Multiverse-Core, ProtocolLib]
commands: commands: