Merge branch 'development'

This commit is contained in:
Brianna 2020-03-31 07:23:56 -04:00
commit 6bdfb0ace4
179 changed files with 7164 additions and 4033 deletions

13
pom.xml
View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId>
<version>2.1.2</version>
<version>2.2</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>FabledSkyblock-${project.version}</finalName>
@ -105,7 +105,7 @@
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>jitpack.io</id>
@ -123,6 +123,10 @@
<id>private</id>
<url>https://repo.songoda.com/artifactory/private/</url>
</repository>
<repository>
<id>public</id>
<url>http://repo.songoda.com/artifactory/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
@ -186,9 +190,8 @@
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId>
<version>7.0.0</version>
<scope>provided</scope>
<artifactId>worldedit-bukkit</artifactId>
<version>7.1.0</version>
</dependency>
<dependency>
<groupId>com.songoda</groupId>

View File

@ -8,6 +8,7 @@ import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.api.SkyBlockAPI;
import com.songoda.skyblock.ban.BanManager;
import com.songoda.skyblock.biome.BiomeManager;
import com.songoda.skyblock.challenge.FabledChallenge;
import com.songoda.skyblock.command.CommandManager;
import com.songoda.skyblock.command.commands.SkyBlockCommand;
import com.songoda.skyblock.config.FileManager;
@ -17,6 +18,7 @@ import com.songoda.skyblock.generator.GeneratorManager;
import com.songoda.skyblock.hologram.HologramManager;
import com.songoda.skyblock.invite.InviteManager;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.reward.RewardManager;
import com.songoda.skyblock.leaderboard.LeaderboardManager;
import com.songoda.skyblock.levelling.rework.IslandLevelManager;
import com.songoda.skyblock.limit.LimitationInstanceHandler;
@ -78,6 +80,8 @@ public class SkyBlock extends SongodaPlugin {
private HologramManager hologramManager;
private LimitationInstanceHandler limitationHandler;
private LocalizationManager localizationManager;
private RewardManager rewardManager;
private FabledChallenge fabledChallenge;
public static SkyBlock getInstance() {
return INSTANCE;
@ -107,6 +111,7 @@ public class SkyBlock extends SongodaPlugin {
playerDataManager = new PlayerDataManager(this);
cooldownManager = new CooldownManager(this);
limitationHandler = new LimitationInstanceHandler();
fabledChallenge = new FabledChallenge(this);
if (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Scoreboard.Enable")) {
scoreboardManager = new ScoreboardManager(this);
@ -136,6 +141,9 @@ public class SkyBlock extends SongodaPlugin {
messageManager = new MessageManager(this);
hologramManager = new HologramManager(this);
rewardManager = new RewardManager(this);
rewardManager.loadRewards();
new PlaytimeTask(playerDataManager, islandManager).runTaskTimerAsynchronously(this, 0L, 20L);
new VisitTask(playerDataManager).runTaskTimerAsynchronously(this, 0L, 20L);
new ConfirmationTask(playerDataManager).runTaskTimerAsynchronously(this, 0L, 20L);
@ -159,6 +167,8 @@ public class SkyBlock extends SongodaPlugin {
pluginManager.registerEvents(new Spawner(this), this);
pluginManager.registerEvents(new Food(this), this);
pluginManager.registerEvents(new Grow(this), this);
pluginManager.registerEvents(new Piston(this), this);
pluginManager.registerEvents(new FallBreak(this), this);
if (pluginManager.isPluginEnabled("EpicSpawners")) pluginManager.registerEvents(new EpicSpawners(this), this);
if (pluginManager.isPluginEnabled("WildStacker")) pluginManager.registerEvents(new WildStacker(this), this);
@ -211,6 +221,10 @@ public class SkyBlock extends SongodaPlugin {
this.hologramManager.onDisable();
}
if (this.fabledChallenge != null) {
this.fabledChallenge.onDisable();
}
HandlerList.unregisterAll(this);
}
@ -336,4 +350,12 @@ public class SkyBlock extends SongodaPlugin {
public LocalizationManager getLocalizationManager() {
return localizationManager;
}
public RewardManager getRewardManager() {
return rewardManager;
}
public FabledChallenge getFabledChallenge() {
return fabledChallenge;
}
}

View File

@ -58,7 +58,7 @@ public class Island {
*/
public void setSize(int size) {
Preconditions.checkArgument(size <= 1000, "Cannot set size to greater than 1000");
Preconditions.checkArgument(size >= 50, "Cannot set size to less than 50");
Preconditions.checkArgument(size >= 20, "Cannot set size to less than 20");
this.handle.setSize(size);
}

View File

@ -1,7 +1,8 @@
package com.songoda.skyblock.api.island;
import com.google.common.base.Preconditions;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Material;
public class IslandLevel {
@ -45,7 +46,7 @@ public class IslandLevel {
*/
public void setMaterialAmount(Material material, int amount) {
Preconditions.checkArgument(material != null, "Cannot set material amount to null material");
this.handle.getIsland().getLevel().setMaterialAmount(Materials.fromString(material.name()).name(), amount);
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).name(), amount);
}
/**
@ -53,7 +54,8 @@ public class IslandLevel {
*/
public void setMaterialAmount(Material material, byte data, int amount) {
Preconditions.checkArgument(material != null, "Cannot set material amount to null material");
this.handle.getIsland().getLevel().setMaterialAmount(Materials.requestMaterials(material.name(), data).name(),
//TODO: Add data support
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).name(),
amount);
}
@ -63,7 +65,7 @@ public class IslandLevel {
public long getMaterialAmount(Material material) {
Preconditions.checkArgument(material != null, "Cannot get material amount to null material");
Materials materials = Materials.fromString(material.name());
CompatibleMaterial materials = CompatibleMaterial.getMaterial(material.name());
com.songoda.skyblock.island.IslandLevel level = this.handle.getIsland().getLevel();
if (level.getMaterials().containsKey(materials.name())) {
@ -79,7 +81,8 @@ public class IslandLevel {
public long getMaterialAmount(Material material, byte data) {
Preconditions.checkArgument(material != null, "Cannot get material amount to null material");
Materials materials = Materials.requestMaterials(material.name(), data);
CompatibleMaterial materials = CompatibleMaterial.getMaterial(material.name());
//TODO: data support
com.songoda.skyblock.island.IslandLevel level = this.handle.getIsland().getLevel();
if (level.getMaterials().containsKey(materials.name())) {
@ -94,7 +97,7 @@ public class IslandLevel {
*/
public long getMaterialPoints(Material material) {
Preconditions.checkArgument(material != null, "Cannot get material points to null material");
return this.handle.getIsland().getLevel().getMaterialPoints(Materials.fromString(material.name()).name());
return this.handle.getIsland().getLevel().getMaterialPoints(CompatibleMaterial.getMaterial(material.name()).name());
}
/**
@ -103,7 +106,8 @@ public class IslandLevel {
public long getMaterialPoints(Material material, byte data) {
Preconditions.checkArgument(material != null, "Cannot get material points to null material");
return this.handle.getIsland().getLevel()
.getMaterialPoints(Materials.requestMaterials(material.name(), data).name());
.getMaterialPoints(CompatibleMaterial.getMaterial(material.name()).name());
//TODO: add data support
}
/**

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.api.structure;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
import java.util.List;
@ -8,9 +8,9 @@ public interface Structure {
String getName();
Materials getMaterials();
CompatibleMaterial getMaterials();
void setMaterials(Materials materials);
void setMaterials(CompatibleMaterial materials);
String getOverworldFile();

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.ban;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
@ -86,7 +86,7 @@ public class BanManager {
LocationUtil.teleportPlayerToSpawn(targetPlayer);
messageManager.sendMessage(targetPlayer, configLoad.getString("Island.Visit.Banned.Island.Message"));
soundManager.playSound(targetPlayer, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
}
}

View File

@ -9,6 +9,7 @@ import java.util.Map.Entry;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Material;
@ -91,8 +92,6 @@ public final class BlockScanner extends BukkitRunnable {
final ConfigurationSection liquidSection = config.getConfigurationSection("Island.World." + env + ".Liquid");
System.out.println("LiquidSection: " + liquidSection);
for (List<ChunkSnapshot> sub : parts) {
queueWork(world, liquidSection.getBoolean("Enable") ? liquidSection.getInt("Height") + 1 : 0, sub);
}

View File

@ -0,0 +1,64 @@
package com.songoda.skyblock.challenge;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.challenge.challenge.ChallengeCategory;
import com.songoda.skyblock.challenge.challenge.ChallengeManager;
import com.songoda.skyblock.challenge.defaultinv.DefaultInventory;
import com.songoda.skyblock.challenge.inventory.InventoryManager;
import com.songoda.skyblock.challenge.inventory.inv.ChallengeInventory;
import com.songoda.skyblock.challenge.player.PlayerManager;
public class FabledChallenge {
private SkyBlock skyblock;
private ChallengeManager challengeManager;
private PlayerManager playerManager;
// I use my own inventory api bc it's hard to implement inventories with the
private InventoryManager inventoryManager;
private DefaultInventory defaultInventory;
private ChallengeInventory challengeInventory;
public FabledChallenge(SkyBlock skyblock) {
this.skyblock = skyblock;
this.defaultInventory = new DefaultInventory(skyblock);
this.challengeManager = new ChallengeManager(skyblock);
this.playerManager = new PlayerManager(skyblock);
this.challengeInventory = new ChallengeInventory(this);
this.inventoryManager = new InventoryManager(skyblock);
this.inventoryManager.init();
}
public void onDisable() {
this.inventoryManager.closeInventories();
}
public void openChallengeInventory(Player p, ChallengeCategory category) {
if (category == null)
return;
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> {
inventoryManager.openInventory(challengeInventory, p, params -> {
params.put(ChallengeInventory.CATEGORY, category);
});
}, 1);
}
// GETTERS
public ChallengeManager getChallengeManager() {
return challengeManager;
}
public PlayerManager getPlayerManager() {
return playerManager;
}
public InventoryManager getInventoryManager() {
return inventoryManager;
}
public DefaultInventory getDefaultInventory() {
return defaultInventory;
}
}

View File

@ -0,0 +1,494 @@
package com.songoda.skyblock.challenge.challenge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Pattern;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionType;
import com.songoda.skyblock.api.SkyBlockAPI;
import com.songoda.skyblock.api.island.Island;
public class Challenge {
private ChallengeCategory category;
private int id;
private String name;
private int maxTimes;
private boolean showInChat;
private List<Peer<Type, Object>> requires;
private List<Peer<Type, Object>> rewards;
private ItemChallenge item;
public Challenge(ChallengeCategory category, int id, String name, int maxTimes, boolean showInChat,
List<String> requires, List<String> rewards, ItemChallenge item) {
this.category = category;
this.id = id;
this.name = name;
this.maxTimes = maxTimes;
this.showInChat = showInChat;
this.item = item;
item.setChallenge(this);
loadChallenge(requires, rewards);
}
private void loadChallenge(List<String> requires, List<String> rewards) {
this.requires = new ArrayList<>();
this.rewards = new ArrayList<>();
// Requires
for (String str : requires) {
int idx = str.indexOf(':');
if (idx == -1)
throw new IllegalArgumentException("Line \"" + str + "\" isn't a correct line");
String arg0 = str.substring(0, idx);
String arg1 = str.substring(idx + 1);
try {
Type t = Type.valueOf(arg0);
this.requires.add(new Peer<Type, Object>(t, t.convert(arg1)));
} catch (IllegalArgumentException ex) {
throw new IllegalArgumentException("Invalid line : " + str + " : " + ex.getMessage());
} catch (Exception ex) {
throw new IllegalArgumentException("Invalid line : " + str);
}
}
// Rewards
for (String str : rewards) {
int idx = str.indexOf(':');
if (idx == -1)
throw new IllegalArgumentException("Line " + str + " isn't a correct line");
String arg0 = str.substring(0, idx);
String arg1 = str.substring(idx + 1);
try {
Type t = Type.valueOf(arg0);
this.rewards.add(new Peer<Type, Object>(t, t.convert(arg1)));
} catch (IllegalArgumentException ex) {
throw new IllegalArgumentException("Invalid line : " + str + ": " + ex.getMessage());
} catch (Exception ex) {
throw new IllegalArgumentException("Invalid line : " + str);
}
}
}
// GETTERS
public ChallengeCategory getCategory() {
return category;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public int getMaxTimes() {
return maxTimes;
}
public boolean isShowInChat() {
return showInChat;
}
public List<Peer<Type, Object>> getRequires() {
return requires;
}
public List<Peer<Type, Object>> getRewards() {
return rewards;
}
public ItemChallenge getItem() {
return item;
}
public static enum Type {
ITEM {
// An item
/**
* Convert the value to a useable ItemStack
*/
@Override
public Object convert(String value) throws IllegalArgumentException {
if (value == null || "".equalsIgnoreCase(value.trim()))
throw new IllegalArgumentException("Value is empty or null");
int index = value.indexOf(' ');
// The id
String id = index == -1 ? value : value.substring(0, index);
// Check if it's a Minecraft item
Material m = CompatibleMaterial.getMaterial(id).getMaterial();
//Material m = Material.matchMaterial(id);
if (m == null)
throw new IllegalArgumentException(
"\"" + id + "\" isn't a correct Minecraft Material (value = \"" + value + "\")");
int amount = 1;
if (index != -1) {
String strAmount = value.substring(index + 1);
try {
amount = Integer.parseInt(strAmount);
} catch (NumberFormatException ex) {
throw new IllegalArgumentException(
"\"" + strAmount + "\" isn't a correct number (value = \"" + value + "\")");
}
}
return new ItemStack(m, amount);
}
@Override
public boolean has(Player p, Object obj) {
// Check if player has specific item in his inventory
ItemStack is = (ItemStack) obj;
return p.getInventory().contains(is.getType(), is.getAmount());
}
@Override
public void executeRequire(Player p, Object obj) {
// Remove specific item in player's inventory
ItemStack is = (ItemStack) obj;
p.getInventory().removeItem(new ItemStack(is.getType(), is.getAmount()));
// TODO LOG
}
@Override
public void executeReward(Player p, Object obj) {
// Give specific item to player
ItemStack is = (ItemStack) obj;
HashMap<Integer, ItemStack> rest = p.getInventory()
.addItem(new ItemStack(is.getType(), is.getAmount()));
for (ItemStack restIs : rest.values())
p.getWorld().dropItem(p.getLocation(), restIs);
// TODO LOG
}
},
CMD {
// A command to execute
@Override
public Object convert(String value) throws IllegalArgumentException {
// Here we don't have to convert the value because the value is the command
if (value == null || "".equalsIgnoreCase(value))
throw new IllegalArgumentException("Value is empty or null");
return value;
}
@Override
public boolean has(Player p, Object obj) {
// CMD only works as a reward so we return false to prevent that
return false;
}
@Override
public void executeRequire(Player p, Object obj) {
// Nothing to do here
}
@Override
public void executeReward(Player p, Object obj) {
// Obj is a String
Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
obj.toString().replaceAll("\\{player\\}", p.getName()));
}
},
LEVEL {
// The level of island of a player
@Override
public Object convert(String value) throws IllegalArgumentException {
// Convert the value to an Integer representing the minimum level of island
// required
if (value == null || "".equalsIgnoreCase(value))
throw new IllegalArgumentException("Value is empty or null");
try {
return Integer.parseInt(value);
} catch (NumberFormatException ex) {
throw new IllegalArgumentException(
"\"" + value + "\" isn't a correct number (value = \"" + value + "\")");
}
}
@Override
public boolean has(Player p, Object obj) {
// Check if the level of player's island is greater or equals to the required
// level
Island is = SkyBlockAPI.getIslandManager().getIsland(p);
// Player doesn't have an island
if (is == null)
return false;
return is.getLevel().getLevel() >= (Integer) obj;
}
@Override
public void executeRequire(Player p, Object obj) {
// Nothing to do here
}
@Override
public void executeReward(Player p, Object obj) {
// Nothing to do here
}
},
NEAR {
@Override
public Object convert(String value) throws IllegalArgumentException {
// We returns the entity type and the number of entity required
if (value == null || "".equalsIgnoreCase(value))
throw new IllegalArgumentException("Value is empty or null");
int index = value.indexOf(' ');
// The id
String id = index == -1 ? value : value.substring(0, index);
// Check if it's a Minecraft item
EntityType et;
try {
et = EntityType.valueOf(id.toUpperCase());
} catch (Exception ex) {
throw new IllegalArgumentException(
"\"" + id + "\" isn't a correct Minecraft EntityType (value = \"" + value + "\")");
}
if (et == null)
throw new IllegalArgumentException(
"\"" + id + "\" isn't a correct Minecraft EntityType (value = \"" + value + "\")");
int amount = 1;
if (index != -1) {
String strAmount = value.substring(index + 1);
try {
amount = Integer.parseInt(strAmount);
} catch (NumberFormatException ex) {
throw new IllegalArgumentException(
"\"" + strAmount + "\" isn't a correct number (value = \"" + value + "\")");
}
}
return new Peer<EntityType, Integer>(et, amount);
}
@Override
public boolean has(Player p, Object obj) {
// Check if player is next to specific mob
Peer<EntityType, Integer> peer = (Peer<EntityType, Integer>) obj;
List<Entity> entities = p.getNearbyEntities(60, 60, 60);
int count = 0;
for (Entity e : entities) {
if (e.getType() == peer.getKey())
count++;
if (count == peer.getValue())
return true;
}
return false;
}
@Override
public void executeRequire(Player p, Object obj) {
// Nothing to do here
}
@Override
public void executeReward(Player p, Object obj) {
// Nothing to do here
}
},
POTION {
private Pattern space = Pattern.compile(" ");
@Override
public Object convert(String value) throws IllegalArgumentException {
// We returns the potion required
if (value == null || "".equalsIgnoreCase(value))
throw new IllegalArgumentException("Value is empty or null");
String[] split = space.split(value);
if (split.length != 3)
throw new IllegalArgumentException("Incorrect value : \"" + value + "\"");
// The id
// Check if it's a Minecraft item
PotionType pt;
try {
pt = PotionType.valueOf(split[0].toUpperCase());
} catch (Exception ex) {
throw new IllegalArgumentException(
"\"" + split[0] + "\" isn't a correct Minecraft PotionType (value = \"" + value + "\")");
}
if (pt == null)
throw new IllegalArgumentException(
"\"" + split[0] + "\" isn't a correct Minecraft PotionType (value = \"" + value + "\")");
// The data
int data;
try {
data = Integer.parseInt(split[1]);
} catch (NumberFormatException ex) {
throw new IllegalArgumentException(
"\"" + split[1] + "\" isn't a correct number (value = \"" + value + "\")");
}
if (data < 0 || data > 8)
throw new IllegalArgumentException("Data must be between 0 and 8, but is \"" + split[1] + "\"");
int amount;
try {
amount = Integer.parseInt(split[2]);
} catch (NumberFormatException ex) {
throw new IllegalArgumentException(
"\"" + split[2] + "\" isn't a correct number (value = \"" + value + "\")");
}
return new Peer<PotionType, Peer<Integer, Integer>>(pt, new Peer<>(data, amount));
}
@Override
public boolean has(Player p, Object obj) {
Peer<PotionType, Peer<Integer, Integer>> peer = (Peer<PotionType, Peer<Integer, Integer>>) obj;
Inventory inv = p.getInventory();
int count = 0;
for (ItemStack is : inv) {
if (is != null && is.getType() != Material.AIR
&& isSame(is, peer.getKey(), peer.getValue().getKey())) {
// Same potion
count += is.getAmount();
if (count >= peer.getValue().getValue())
return true;
}
}
return false;
}
@Override
public void executeRequire(Player p, Object obj) {
// Remove specific potions in player's inventory
Peer<PotionType, Peer<Integer, Integer>> peer = (Peer<PotionType, Peer<Integer, Integer>>) obj;
Inventory inv = p.getInventory();
int rest = peer.getValue().getValue();
for (ItemStack is : inv) {
if (is != null && is.getType() != Material.AIR
&& isSame(is, peer.getKey(), peer.getValue().getKey())) {
// Same potion, remove it
if (rest > is.getAmount()) {
rest -= is.getAmount();
is.setAmount(0);
} else {
is.setAmount(is.getAmount() - rest);
p.updateInventory();
return;
}
}
}
}
@Override
public void executeReward(Player p, Object obj) {
// Give specific item to player
Peer<PotionType, Peer<Integer, Integer>> peer = (Peer<PotionType, Peer<Integer, Integer>>) obj;
ItemStack is = null;
int data = peer.getValue().getKey();
if (data <= 2)
is = new ItemStack(Material.POTION, peer.getValue().getValue());
else if (data <= 5)
is = new ItemStack(Material.LINGERING_POTION, peer.getValue().getValue());
else if (data <= 8)
is = new ItemStack(Material.SPLASH_POTION, peer.getValue().getValue());
PotionMeta pm = (PotionMeta) is.getItemMeta();
pm.setBasePotionData(new PotionData(peer.getKey(), data == 1 || data == 4 || data == 7,
data == 2 || data == 5 || data == 8));
is.setItemMeta(pm);
// Add item or drop if inventory is full
HashMap<Integer, ItemStack> rest = p.getInventory().addItem(is);
for (ItemStack restIs : rest.values())
p.getWorld().dropItem(p.getLocation(), restIs);
// TODO LOG
}
/**
* Check if:
* <ul>
* <li>Type of ItemStack is Potion or Lingering Potion or Splash Potion</li>
* <li>The potion is of type type</li>
* </ul>
* data must be:
* <ul>
* <li>0 = normal potion</li>
* <li>1 = extended</li>
* <li>2 = ++</li>
* <li>3 = splash</li>
* <li>4 = splash extended</li>
* <li>5 = splash ++</li>
* <li>6 = lingering</li>
* <li>7 = lingering extended</li>
* <li>8 = lingering ++</li>
* </ul>
*
* @param is
* @param type
* @param data
* @return
*/
private boolean isSame(ItemStack is, PotionType type, int data) {
if (data <= 2 && is.getType() != Material.POTION)
return false;
else if (data >= 3 && data <= 5 && is.getType() != Material.LINGERING_POTION)
return false;
else if (data >= 6 && data <= 8 && is.getType() != Material.SPLASH_POTION)
return false;
PotionMeta pm = (PotionMeta) is.getItemMeta();
PotionData pd = pm.getBasePotionData();
if (pd.getType() != type)
return false;
else if ((data == 0 || data == 3 || data == 6) && (pd.isExtended() || pd.isUpgraded()))
return false;
else if ((data == 1 || data == 4 || data == 7) && !pd.isExtended())
return false;
else if ((data == 2 || data == 5 || data == 8) && !pd.isUpgraded())
return false;
return true;
}
};
/**
* Try to convert the value to a useable object used later
*
* @param value
* The value to convert
* @return A useable object required
*/
public abstract Object convert(String value) throws IllegalArgumentException;
/**
* Check if specific player has requirement for specific object
*
* @param p
* The player
* @param obj
* The object
* @return true if specific player has requirement for this object
*/
public abstract boolean has(Player p, Object obj);
/**
* Execute an action associated with specific object for specific player
*
* @param p
* The player
* @param obj
* The object
*/
public abstract void executeRequire(Player p, Object obj);
/**
* Give a reward to specific player for specific object
*
* @param p
* The player
* @param obj
* The object
*/
public abstract void executeReward(Player p, Object obj);
}
}

View File

@ -0,0 +1,99 @@
package com.songoda.skyblock.challenge.challenge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
public class ChallengeCategory {
private int id;
private String name;
private HashMap<Integer, Challenge> challenges;
public ChallengeCategory(int id, String name, FileConfiguration config) {
this.id = id;
this.name = name;
challenges = new HashMap<>();
loadChallenges(config);
}
private void loadChallenges(FileConfiguration config) {
ConfigurationSection section = config.getConfigurationSection("challenges." + id + ".challenges");
if (section == null)
// No challenge here
return;
Set<String> keys = section.getKeys(false);
for (String k : keys) {
String key = "challenges." + id + ".challenges." + k;
int id = config.getInt(key + ".id");
if (id == 0)
throw new IllegalArgumentException("Invalid id at category " + this.name + "(" + this.id
+ ") at challenge " + name + "(" + id + ")");
String name = ChatColor.translateAlternateColorCodes('&', config.getString(key + ".name"));
List<String> require = toColor(config.getStringList(key + ".require"));
List<String> reward = toColor(config.getStringList(key + ".reward"));
int maxTimes = config.getInt(key + ".maxtimes");
boolean showInChat = config.getBoolean(key + ".showInChat");
// Item
boolean show = config.getBoolean(key + ".item.show");
int row = show ? config.getInt(key + ".item.row") : 0;
int col = show ? config.getInt(key + ".item.col") : 0;
String strItem = show ? config.getString(key + ".item.item") : "AIR";
if (strItem == null)
strItem = "AIR";
int amount = show ? config.getInt(key + ".item.amount") : 0;
List<String> lore = show ? toColor(config.getStringList(key + ".item.lore")) : new ArrayList<>();
if (lore == null)
lore = new ArrayList<>();
try {
// If an Exception occurs, we don't handle it here but in parent class
System.out.println(strItem);
Material item = CompatibleMaterial.getMaterial(strItem).getMaterial();
if (item == null)
throw new IllegalArgumentException("Item " + strItem + " isn't a correct material");
ItemChallenge ic = new ItemChallenge(show, row, col, item, amount, lore);
Challenge c = new Challenge(this, id, name, maxTimes, showInChat, require, reward, ic);
challenges.put(id, c);
} catch (IllegalArgumentException ex) {
throw new IllegalArgumentException("Exception at category " + this.name + "(" + this.id
+ ") at challenge " + name + "(" + id + "): " + ex.getMessage());
}
}
Bukkit.getLogger().info("[FabledSkyBlock] " + ChatColor.GREEN + " Category " + name + ChatColor.GREEN
+ " loaded with " + ChatColor.GOLD + challenges.size() + ChatColor.GREEN + " challenges");
}
private List<String> toColor(List<String> list) {
List<String> copy = new ArrayList<>();
if (list == null)
return copy;
for (String str : list)
copy.add(ChatColor.translateAlternateColorCodes('&', str));
return copy;
}
// GETTERS
public Challenge getChallenge(int id) {
return challenges.get(id);
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public HashMap<Integer, Challenge> getChallenges() {
return challenges;
}
}

View File

@ -0,0 +1,50 @@
package com.songoda.skyblock.challenge.challenge;
import java.io.File;
import java.util.HashMap;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager.Config;
public class ChallengeManager {
private SkyBlock skyblock;
private HashMap<Integer, ChallengeCategory> categories;
public ChallengeManager(SkyBlock skyblock) {
this.skyblock = skyblock;
categories = new HashMap<>();
loadChallenges();
}
private void loadChallenges() {
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "challenges.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
try {
ConfigurationSection section = configLoad.getConfigurationSection("challenges");
if (section != null) {
for (String k : section.getKeys(false)) {
int id = configLoad.getInt("challenges." + k + ".id");
String name = ChatColor.translateAlternateColorCodes('&', configLoad.getString("challenges." + k + ".name"));
ChallengeCategory cc = new ChallengeCategory(id, name, configLoad);
categories.put(id, cc);
}
}
} catch (IllegalArgumentException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Error while loading challenges:", ex);
return;
}
Bukkit.getLogger().info("[FabledSkyBlock] " + ChatColor.GREEN + " challenges loaded with " + ChatColor.GOLD
+ categories.size() + ChatColor.GREEN + " categories");
}
public ChallengeCategory getChallenge(int id) {
return categories.get(id);
}
}

View File

@ -0,0 +1,87 @@
package com.songoda.skyblock.challenge.challenge;
import java.io.File;
import java.util.List;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
public class ItemChallenge {
private Challenge challenge;
private boolean show;
private int row;
private int col;
private Material type;
private int amount;
private List<String> lore;
private String itemTitle;
public ItemChallenge(boolean show, int row, int col, Material type, int amount, List<String> lore) {
this.show = show;
this.row = row;
this.col = col;
this.type = type;
this.amount = amount;
this.lore = lore;
FileManager.Config langConfig = SkyBlock.getInstance().getFileManager()
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml"));
FileConfiguration langConfigLoad = langConfig.getFileConfiguration();
itemTitle = langConfigLoad.getString("Challenge.Inventory.Item.Title");
}
public ItemStack createItem(UUID player, int amount) {
ItemStack is = new ItemStack(type, this.amount);
// Air
ItemMeta im = is.getItemMeta();
if (im != null) {
im.setDisplayName(ChatColor.translateAlternateColorCodes('&',
itemTitle.replace("%challenge", challenge.getName()).replace("%amount", Integer.toString(amount))
.replace("%max", Integer.toString(challenge.getMaxTimes()))));
im.setLore(lore);
is.setItemMeta(im);
}
return is;
}
// GETTERS & SETTERS
public Challenge getChallenge() {
return challenge;
}
public void setChallenge(Challenge challenge) {
this.challenge = challenge;
}
public boolean isShow() {
return show;
}
public int getRow() {
return row;
}
public int getCol() {
return col;
}
public Material getType() {
return type;
}
public int getAmount() {
return amount;
}
public List<String> getLore() {
return lore;
}
}

View File

@ -0,0 +1,19 @@
package com.songoda.skyblock.challenge.challenge;
public class Peer<E, F> {
private E key;
private F value;
public Peer(E key, F value) {
this.key = key;
this.value = value;
}
public E getKey() {
return key;
}
public F getValue() {
return value;
}
}

View File

@ -0,0 +1,76 @@
package com.songoda.skyblock.challenge.defaultinv;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager.Config;
public class DefaultInventory {
private final Item defaultItem = new Item(new ItemStack(Material.AIR));
private int size;
private Item[][] items;
public DefaultInventory(SkyBlock skyblock) {
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "challenges.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
size = configLoad.getInt("inventory.size");
items = new Item[9][size];
ConfigurationSection section = configLoad.getConfigurationSection("inventory.items");
if (section == null)
// No items
return;
for (String key : section.getKeys(false)) {
String k = "inventory.items." + key;
int row = configLoad.getInt(k + ".row");
int col = configLoad.getInt(k + ".col");
String strItem = configLoad.getString(k + ".item");
int amount = configLoad.getInt(k + ".amount");
String name = ChatColor.translateAlternateColorCodes('&', configLoad.getString(k + ".name"));
List<String> lore = toColor(configLoad.getStringList(k + ".lore"));
int redirect = configLoad.getInt(k + ".redirect");
Material item = Material.matchMaterial(strItem);
if (item == null || item == Material.AIR) {
Bukkit.getLogger().warning("Item " + strItem + " is not a Material");
continue;
}
ItemStack is = new ItemStack(item, amount);
ItemMeta im = is.getItemMeta();
im.setDisplayName(name);
im.setLore(lore);
is.setItemMeta(im);
items[col - 1][row - 1] = new Item(is, redirect);
}
}
private List<String> toColor(List<String> list) {
List<String> copy = new ArrayList<>();
if (list == null)
return copy;
for (String str : list)
copy.add(ChatColor.translateAlternateColorCodes('&', str));
return copy;
}
public Item get(int row, int col) {
Item is = items[col][row];
if (is == null)
is = defaultItem;
// Clone it
return new Item(is.getItemStack().clone(), is.getRedirect());
}
public int getSize() {
return size;
}
}

View File

@ -0,0 +1,25 @@
package com.songoda.skyblock.challenge.defaultinv;
import org.bukkit.inventory.ItemStack;
public class Item {
private ItemStack itemStack;
private int redirect;
public Item(ItemStack itemStack) {
this(itemStack, 0);
}
public Item(ItemStack itemStack, int redirect) {
this.itemStack = itemStack;
this.redirect = redirect;
}
public ItemStack getItemStack() {
return itemStack;
}
public int getRedirect() {
return redirect;
}
}

View File

@ -0,0 +1,40 @@
/**
*
*/
package com.songoda.skyblock.challenge.inventory;
import java.util.function.Consumer;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
public class ClickableItem {
private ItemStack item;
private Consumer<InventoryClickEvent> event;
private ClickableItem(ItemStack item, Consumer<InventoryClickEvent> event) {
this.item = item;
this.event = event;
}
public void run(InventoryClickEvent e) {
event.accept(e);
}
public ItemStack getItemStack() {
return item;
}
public Consumer<InventoryClickEvent> getEvent() {
return event;
}
public static ClickableItem of(ItemStack is) {
return new ClickableItem(is, e -> {
});
}
public static ClickableItem of(ItemStack is, Consumer<InventoryClickEvent> event) {
return new ClickableItem(is, event);
}
}

View File

@ -0,0 +1,207 @@
/**
*
*/
package com.songoda.skyblock.challenge.inventory;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
public class Inventory {
public static final String TICK = "tick";
private HashMap<String, Object> values;
private Player player;
private InventoryProvider inventoryProvider;
private int size;
private List<Integer> excluseCases;
private ClickableItem[] items;
private org.bukkit.inventory.Inventory bukkitInventory;
public Inventory(Player player, InventoryProvider inventoryProvider, Consumer<Inventory> params) {
this.values = new HashMap<>();
this.player = player;
this.inventoryProvider = inventoryProvider;
params.accept(this);
this.excluseCases = inventoryProvider.excluseCases(this);
this.size = inventoryProvider.rows(this);
this.items = new ClickableItem[9 * size];
this.bukkitInventory = Bukkit.createInventory(player, size * 9, inventoryProvider.title(this));
put(TICK, 0);
}
public Player getPlayer() {
return player;
}
public InventoryProvider getInventoryProvider() {
return inventoryProvider;
}
public org.bukkit.inventory.Inventory getBukkitInventory() {
return bukkitInventory;
}
public int getRows() {
return size;
}
public List<Integer> getExcludeCases() {
return excluseCases;
}
public void set(int col, int row, ClickableItem item) {
if (col < 1 || col > 9)
throw new IllegalArgumentException("col must be between 1 and 9 but is " + col);
if (row < 1 || row > getRows())
throw new IllegalArgumentException("row must be between 1 and " + getRows());
set(locToPos(col, row), item);
}
public void set(int pos, ClickableItem item) {
if (pos < 0 || pos > size * 9 - 1)
throw new IllegalArgumentException("pos must be between 0 and " + (size * 9 - 1) + ", but is " + pos);
items[pos] = item;
bukkitInventory.setItem(pos, item == null ? null : item.getItemStack());
}
/**
* Update the item but keep the old event
*/
public void updateItem(int col, int row, ItemStack is) {
if (col < 1 || col > 9)
throw new IllegalArgumentException("col must be between 1 and 9 but is " + col);
if (row < 1 || row > getRows())
throw new IllegalArgumentException("row must be between 1 and " + getRows());
updateItem(locToPos(col, row), is);
}
/**
* Update the item but keep the old event
*/
public void updateItem(int pos, ItemStack is) {
if (pos < 0 || pos > size * 9 - 1)
throw new IllegalArgumentException("pos must be between 0 and " + (size * 9 - 1) + ", but is " + pos);
ClickableItem item = items[pos];
if (item == null)
item = ClickableItem.of(is);
else
item = ClickableItem.of(is, item.getEvent());
set(pos, item);
}
public void fill(ClickableItem item) {
for (int row = 0; row < size; row++)
for (int col = 0; col < 9; col++)
set(row * 9 + col, item);
}
public void rectangle(int col, int row, int width, int height, ClickableItem item) {
if (col < 1 || col > 9)
throw new IllegalArgumentException("col must be between 1 and 9");
if (row < 1 || row > getRows())
throw new IllegalArgumentException("row must be between 1 and the maximum number of rows, but is " + row);
// 10 - col because width starts with 1 and not 0
if (width < 1 || width > 10 - col)
throw new IllegalArgumentException("The width must be between 1 and " + (10 - col) + ", but is " + width);
if (height < 1 || height > getRows() + 1 - row)
throw new IllegalArgumentException("The height must be between 1 and " + (getRows() + 1 - row));
rectangle(locToPos(col, row), width, height, item);
}
public void rectangle(int pos, int width, int height, ClickableItem item) {
if (pos < 0 || pos > size * 9)
throw new IllegalArgumentException("pos must be between 0 and " + (size * 9) + ", but is " + pos);
int[] colRow = posToLoc(pos);
int row = colRow[0];
int col = colRow[1];
if (col < 1 || col > 9)
throw new IllegalArgumentException("col must be between 1 and 9, but is " + col);
if (row < 1 || row > 6)
throw new IllegalArgumentException("row must be between 1 and the maximum number of rows, but is " + row);
// 10 - col because width starts with 1 and not 0
if (width < 1 || width > 10 - col)
throw new IllegalArgumentException("The width must be between 1 and " + (10 - col) + ", but is " + width);
if (height < 1 || height > getRows() + 1 - row)
throw new IllegalArgumentException(
"The height must be between 1 and " + (getRows() + 1 - row) + ", but is " + height);
for (int i = col; i < col + width; i++)
for (int j = row; j < row + height; j++)
// Around
if (i == col || i == col + width - 1 || j == row || j == row + height - 1)
set(i, j, item);
}
public void fillRectangle(int col, int row, int width, int height, ClickableItem item) {
if (col < 1 || col > 9)
throw new IllegalArgumentException("col must be between 1 and 9, but is " + col);
if (row < 1 || row > 6)
throw new IllegalArgumentException("row must be between 1 and the maximum number of rows, but is " + row);
// 10 - col because width starts with 1 and not 0
if (width < 1 || width > 10 - col)
throw new IllegalArgumentException("The width must be between 1 and " + (10 - col) + ", but is " + width);
if (height < 1 || height > getRows() + 1 - row)
throw new IllegalArgumentException(
"The height must be between 1 and " + (getRows() + 1 - row) + ", but is " + height);
fillRectangle(locToPos(col, row), width, height, item);
}
public void fillRectangle(int pos, int width, int height, ClickableItem item) {
if (pos < 0 || pos > size * 9)
throw new IllegalArgumentException("pos must be between 0 and " + (size * 9) + ", but is " + pos);
int[] colRow = posToLoc(pos);
int row = colRow[0];
int col = colRow[1];
if (col < 1 || col > 9)
throw new IllegalArgumentException("col must be between 1 and 9, but is " + col);
if (row < 1 || row > 6)
throw new IllegalArgumentException("row must be between 1 and the maximum number of rows, but is " + row);
// 10 - col because width starts with 1 and not 0
if (width < 1 || width > 10 - col)
throw new IllegalArgumentException("The width must be between 1 and " + (10 - col) + ", but is " + width);
if (height < 1 || height > getRows() + 1 - row)
throw new IllegalArgumentException(
"The height must be between 1 and " + (getRows() + 1 - row) + ", but is " + height);
for (int i = col; i < col + width; i++)
for (int j = row; j < row + height; j++)
set(i, j, item);
}
public void open() {
player.openInventory(bukkitInventory);
}
public void handler(InventoryClickEvent e) {
int pos = e.getSlot();
if (pos < 0 || pos > items.length)
return;
ClickableItem item = items[pos];
if (item == null) {
// Nothing to do
return;
}
item.run(e);
}
public void put(String key, Object value) {
values.put(key, value);
}
public Object get(String key) {
return values.get(key);
}
public int[] posToLoc(int pos) {
return new int[] { (pos / 9) + 1, (pos % 9) + 1 };
}
public int locToPos(int col, int row) {
return (row - 1) * 9 + (col - 1);
}
}

View File

@ -0,0 +1,125 @@
/**
*
*/
package com.songoda.skyblock.challenge.inventory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.UUID;
import java.util.function.Consumer;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import com.songoda.skyblock.SkyBlock;
public class InventoryManager implements Listener {
private SkyBlock skyblock;
private HashMap<UUID, Inventory> inventories;
private int task;
public InventoryManager(SkyBlock skyblock) {
this.skyblock = skyblock;
this.inventories = new HashMap<>();
}
public void init() {
Bukkit.getPluginManager().registerEvents(this, skyblock);
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(skyblock, () -> {
if (inventories.size() == 0)
return;
for (Inventory inv : inventories.values()) {
int tick = 0;
Object currentTick = inv.get(Inventory.TICK);
if (currentTick != null && currentTick instanceof Integer)
tick = Integer.parseInt(currentTick.toString());
inv.put(Inventory.TICK, tick + 1);
inv.getInventoryProvider().update(inv);
}
}, 1, 1);
}
public Inventory openInventory(InventoryProvider provider, Player p) {
return openInventory(provider, p, null);
}
public Inventory openInventory(InventoryProvider provider, Player p, Consumer<Inventory> params) {
Inventory inv = new Inventory(p, provider, params);
inv.getInventoryProvider().init(inv);
inventories.put(inv.getPlayer().getUniqueId(), inv);
inv.open();
return inv;
}
public Inventory getInventory(Player p) {
return inventories.get(p.getUniqueId());
}
public boolean hasInventoryOpened(Player p) {
return inventories.containsKey(p.getUniqueId());
}
public void closeInventory(Player p) {
p.closeInventory();
}
/**
* Close all inventories
*/
public void closeInventories() {
// New ArrayList to prevent CurrentModificationException
for (Inventory inv : new ArrayList<>(inventories.values()))
closeInventory(inv.getPlayer());
inventories.clear();
}
@EventHandler
public void onPlayerInventoryClick(InventoryClickEvent e) {
org.bukkit.inventory.Inventory clickedInventory = e.getClickedInventory();
if (clickedInventory == null)
return;
Player p = (Player) e.getWhoClicked();
Inventory inv = getInventory(p);
if (inv == null)
return;
if (e.getAction() == InventoryAction.COLLECT_TO_CURSOR) {
e.setCancelled(true);
return;
}
if (e.getRawSlot() >= e.getInventory().getSize() && !e.isShiftClick())
return;
if (inv.getExcludeCases() == null || !inv.getExcludeCases().contains(e.getSlot()))
e.setCancelled(true);
if (!inv.getBukkitInventory().equals(clickedInventory)) {
// The player doesn't click on the correct inventory
return;
}
inv.handler(e);
}
@EventHandler
public void onPlayerInventoryDrag(InventoryDragEvent e) {
if (!inventories.containsKey(e.getWhoClicked().getUniqueId()))
return;
e.setCancelled(false);
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerInventoryClose(InventoryCloseEvent e) {
if (!inventories.containsKey(e.getPlayer().getUniqueId()))
return;
org.bukkit.inventory.Inventory invopen = e.getInventory();
Inventory inv = inventories.get(e.getPlayer().getUniqueId());
if (!inv.getBukkitInventory().equals(invopen))
return;
inv.getInventoryProvider().onClose(e, inv);
inventories.remove(e.getPlayer().getUniqueId());
}
}

View File

@ -0,0 +1,27 @@
/**
*
*/
package com.songoda.skyblock.challenge.inventory;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.event.inventory.InventoryCloseEvent;
public interface InventoryProvider {
public String title(Inventory inv);
public int rows(Inventory inv);
public void init(Inventory inv);
public void update(Inventory inv);
public default List<Integer> excluseCases(Inventory inv) {
return new ArrayList<>();
}
public default void onClose(InventoryCloseEvent e, Inventory inv) {
}
}

View File

@ -0,0 +1,93 @@
/**
*
*/
package com.songoda.skyblock.challenge.inventory;
import java.lang.reflect.Field;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
public class ItemBuilder {
private Material m;
private int count;
private int damage;
private String name;
private List<String> lores;
private String texture;
private ItemBuilder() {
}
public static ItemBuilder of(Material m) {
return of(m, 1);
}
public static ItemBuilder of(Material m, int count) {
return of(m, count, (short) 0);
}
public static ItemBuilder of(Material m, int count, int damage) {
ItemBuilder ib = new ItemBuilder();
ib.m = m;
ib.count = count;
ib.damage = damage;
return ib;
}
public ItemBuilder name(String name) {
this.name = name;
return this;
}
public ItemBuilder lore(List<String> lores) {
this.lores = lores;
return this;
}
public ItemBuilder texture(String texture) {
this.texture = texture;
return this;
}
public ItemStack build() {
ItemStack is = new ItemStack(m, count);
if (is instanceof Damageable) {
Damageable d = (Damageable) is;
d.setDamage(damage);
}
ItemMeta im = is.hasItemMeta() ? is.getItemMeta() : Bukkit.getItemFactory().getItemMeta(m);
if (im != null) {
im.setDisplayName(name);
im.setLore(lores);
if (m == Material.PLAYER_HEAD && texture != null && !"".equalsIgnoreCase(texture.trim())) {
SkullMeta headMeta = (SkullMeta) im;
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", texture));
try {
Field profileField = headMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(headMeta, profile);
} catch (IllegalArgumentException | NoSuchFieldException | SecurityException
| IllegalAccessException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Error while setting head texture", ex);
}
}
is.setItemMeta(im);
}
return is;
}
}

View File

@ -0,0 +1,115 @@
package com.songoda.skyblock.challenge.inventory.inv;
import java.util.HashMap;
import java.util.function.Consumer;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import com.songoda.skyblock.challenge.FabledChallenge;
import com.songoda.skyblock.challenge.challenge.Challenge;
import com.songoda.skyblock.challenge.challenge.ChallengeCategory;
import com.songoda.skyblock.challenge.challenge.ItemChallenge;
import com.songoda.skyblock.challenge.defaultinv.DefaultInventory;
import com.songoda.skyblock.challenge.defaultinv.Item;
import com.songoda.skyblock.challenge.inventory.ClickableItem;
import com.songoda.skyblock.challenge.inventory.Inventory;
import com.songoda.skyblock.challenge.inventory.InventoryProvider;
public class ChallengeInventory implements InventoryProvider {
public static final String CATEGORY = "ChallengeCategory";
private FabledChallenge fc;
public ChallengeInventory(FabledChallenge fc) {
this.fc = fc;
}
@Override
public String title(Inventory inv) {
ChallengeCategory category = (ChallengeCategory) inv.get(CATEGORY);
return category.getName();
}
@Override
public int rows(Inventory inv) {
return fc.getDefaultInventory().getSize();
}
@Override
public void init(Inventory inv) {
try {
// Initialize the inventory
ChallengeCategory category = (ChallengeCategory) inv.get(CATEGORY);
HashMap<Challenge, Integer> done = fc.getPlayerManager()
.getPlayer(inv.getPlayer().getUniqueId());
if (done == null) {
// How is that possible
return;
}
// Set background
DefaultInventory di = fc.getDefaultInventory();
for (int row = 0; row < di.getSize(); row++)
for (int col = 0; col < 9; col++) {
Item item = di.get(row, col);
inv.set(col + 1, row + 1, ClickableItem.of(item.getItemStack(), e -> {
if (item.getRedirect() != 0) {
ChallengeCategory cat = fc.getChallengeManager()
.getChallenge(item.getRedirect());
if (cat != null) {
// Open inventory
fc.openChallengeInventory(inv.getPlayer(), cat);
}
}
}));
}
// Set challenges
for (Challenge c : category.getChallenges().values()) {
ItemChallenge ic = c.getItem();
if (!ic.isShow())
continue;
int count = done.getOrDefault(c, 0);
ItemStack is = ic.createItem(inv.getPlayer().getUniqueId(), count);
// If challenge is done, add enchantment to show to player that it's done
if (count >= c.getMaxTimes())
is.addUnsafeEnchantment(Enchantment.OXYGEN, 1);
Consumer<InventoryClickEvent> consumer = e -> {
// Count the new value
int count2 = done.getOrDefault(c, 0);
if (count2 >= c.getMaxTimes()) {
// Do not continue if maxtimes has been reached
return;
}
Player p = inv.getPlayer();
if (fc.getPlayerManager().doChallenge(p, c)) {
// Ok
// Update count
count2 = done.getOrDefault(c, 0);
// Play sound
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
// Update item
ItemStack is2 = ic.createItem(inv.getPlayer().getUniqueId(), count2);
// If challenge is done, add enchantment to show to player that it's done
if (count2 >= c.getMaxTimes())
is2.addUnsafeEnchantment(Enchantment.OXYGEN, 1);
// Update
inv.updateItem(ic.getCol(), ic.getRow(), is2);
} else
p.playSound(p.getLocation(), Sound.BLOCK_GLASS_BREAK, 1, 1);
};
inv.set(ic.getCol(), ic.getRow(), ClickableItem.of(is, consumer));
}
} catch (Exception ex) {
Bukkit.getLogger().log(Level.SEVERE, "", ex);
}
}
@Override
public void update(Inventory inv) {
// Nothing to update here
}
}

View File

@ -0,0 +1,24 @@
package com.songoda.skyblock.challenge.player;
import java.util.HashMap;
import java.util.UUID;
import com.songoda.skyblock.challenge.challenge.Challenge;
public class PlayerChallenge {
private UUID uuid;
private HashMap<Challenge, Integer> challenges;
public PlayerChallenge(UUID uuid, HashMap<Challenge, Integer> challenges) {
this.uuid = uuid;
this.challenges = challenges;
}
public UUID getUuid() {
return uuid;
}
public HashMap<Challenge, Integer> getChallenges() {
return challenges;
}
}

View File

@ -0,0 +1,190 @@
package com.songoda.skyblock.challenge.player;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.challenge.challenge.Challenge;
import com.songoda.skyblock.challenge.challenge.Challenge.Type;
import com.songoda.skyblock.challenge.challenge.ChallengeCategory;
import com.songoda.skyblock.challenge.challenge.Peer;
import com.songoda.skyblock.config.FileManager.Config;
public class PlayerManager {
private SkyBlock skyblock;
private HashMap<UUID, HashMap<Challenge, Integer>> players;
private File playersDirectory;
public PlayerManager(SkyBlock skyblock) {
this.skyblock = skyblock;
players = new HashMap<>();
playersDirectory = new File(skyblock.getDataFolder(), "challenge-data");
if (!playersDirectory.exists())
playersDirectory.mkdirs();
}
public HashMap<Challenge, Integer> getPlayer(UUID uuid) {
return players.get(uuid);
}
/**
* Load specific player
*
* @param uuid
* The uuid of specific player
*/
public void loadPlayer(UUID uuid) {
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory, uuid.toString() + ".yml"));
FileConfiguration fileConfig = config.getFileConfiguration();
HashMap<Challenge, Integer> challenges = new HashMap<>();
ConfigurationSection section = fileConfig.getConfigurationSection("challenges");
Set<String> strs = (section != null) ? section.getKeys(false) : new HashSet<>();
for (String k : strs) {
int id = fileConfig.getInt("challenges." + k + ".id");
ChallengeCategory cc = skyblock.getFabledChallenge().getChallengeManager().getChallenge(id);
// WTF
if (cc == null)
continue;
ConfigurationSection section2 = fileConfig.getConfigurationSection("challenges." + k + ".challenges");
if (section2 != null)
for (String d : section2.getKeys(false)) {
String key = "challenges." + k + ".challenges." + d;
int cId = fileConfig.getInt(key + ".id");
int count = fileConfig.getInt(key + ".count");
Challenge c = cc.getChallenge(cId);
if (c == null)
continue;
challenges.put(c, count);
}
}
players.put(uuid, challenges);
}
/**
* Unload specific player
*
* @param uuid
* The uuid of specific player
*/
public void unloadPlayer(UUID uuid) {
players.remove(uuid);
skyblock.getFileManager().unloadConfig(new File(playersDirectory, uuid.toString() + ".yml"));
}
/**
* Check if specific player can do specific challenge
*
* @param p
* The player
* @param c
* The challenge
* @return true if specific player can execute specific challenge
*/
public boolean canDoChallenge(Player p, Challenge c) {
if (c == null)
return false;
UUID uuid = p.getUniqueId();
HashMap<Challenge, Integer> done = players.get(uuid);
if (done == null) {
// Wtf ?
loadPlayer(uuid);
done = players.get(uuid);
}
int count = done.getOrDefault(c, 0);
if (c.getMaxTimes() != 0 && count >= c.getMaxTimes())
return false;
// Check if player has required items
for (Peer<Type, Object> peer : c.getRequires())
if (!peer.getKey().has(p, peer.getValue()))
return false;
return true;
}
/**
* Perform specific challenge for specific player
*
* @param p
* Specific player
* @param c
* Specific challenge
* @return true if all is good
*/
public boolean doChallenge(Player p, Challenge c) {
if (!canDoChallenge(p, c))
return false;
UUID uuid = p.getUniqueId();
HashMap<Challenge, Integer> done = players.get(uuid);
int count = done.getOrDefault(c, 0);
done.put(c, count + 1);
addChallenge(uuid, c);
// Take items
for (Peer<Type, Object> peer : c.getRequires())
peer.getKey().executeRequire(p, peer.getValue());
for (Peer<Type, Object> peer : c.getRewards())
peer.getKey().executeReward(p, peer.getValue());
// Ok, send message
String broadcast = ChatColor.translateAlternateColorCodes('&',
SkyBlock.getInstance().getFileManager()
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Challenge.Broadcast"));
if (c.isShowInChat())
Bukkit.broadcastMessage(broadcast.replace("%player", p.getName()).replace("%challenge", c.getName())
.replace("%amount", Integer.toString(count + 1))
.replace("%max", Integer.toString(c.getMaxTimes())));
return true;
}
public void addChallenge(UUID uuid, Challenge c) {
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory, uuid.toString() + ".yml"));
FileConfiguration fileConfig = config.getFileConfiguration();
int ccId = c.getCategory().getId();
int cId = c.getId();
int count = 1;
if (fileConfig.contains("challenges." + ccId + ".challenges." + cId + ".count"))
count = fileConfig.getInt("challenges." + ccId + ".challenges." + cId + ".count") + 1;
fileConfig.set("challenges." + ccId + ".id", ccId);
fileConfig.set("challenges." + ccId + ".challenges." + cId + ".id", cId);
fileConfig.set("challenges." + ccId + ".challenges." + cId + ".count", count);
try {
fileConfig.save(new File(playersDirectory, uuid.toString() + ".yml"));
} catch (IOException ex) {
ex.printStackTrace();
}
}
/**
* Return the number of time specific player has done specific challenge
*
* @param uuid
* The player's uuid
* @param c
* The challenge
* @return The number of time specific challenge has been done by player
*/
public int getChallengeCount(UUID uuid, Challenge c) {
HashMap<Challenge, Integer> challenges = players.get(uuid);
if (challenges != null) {
return challenges.getOrDefault(c, 0);
} else {
// Not connected, check in file
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory, uuid.toString() + ".yml"));
FileConfiguration fileConfig = config.getFileConfiguration();
int ccId = c.getCategory().getId();
int cId = c.getId();
if (!fileConfig.contains("challenges." + ccId + ".challenges." + cId + ".count"))
return 0;
return fileConfig.getInt("challenges." + ccId + ".challenges." + cId + ".count");
}
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.command.commands.admin.*;
import com.songoda.skyblock.command.commands.island.CreateCommand;
@ -16,7 +17,6 @@ import com.songoda.skyblock.menus.ControlPanel;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.skyblock.utils.version.Sounds;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@ -55,6 +55,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
new BiomeCommand(),
new BorderCommand(),
new CancelCommand(),
new ChallengeCommand(),
new ChatCommand(),
new CloseCommand(),
new ConfirmCommand(),
@ -75,6 +76,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
new MembersCommand(),
new OpenCommand(),
new OwnerCommand(),
new PreviewCommand(),
new PromoteCommand(),
new PublicCommand(),
new SetSpawnCommand(),
@ -144,12 +146,12 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (!canUseControlPanel) {
messageManager.sendMessage(player, configLoad.getString("Command.PermissionDenied.Island.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return true;
}
ControlPanel.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
}
@ -169,7 +171,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (!canUseHelp) {
messageManager.sendMessage(player, configLoad.getString("Command.PermissionDenied.Island.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return true;
}
@ -185,7 +187,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Help.Integer.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return true;
}
@ -207,7 +209,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (!canUseHelp) {
messageManager.sendMessage(player, configLoad.getString("Command.PermissionDenied.Admin.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return true;
}
@ -223,7 +225,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Help.Integer.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F,
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F,
1.0F);
return true;
@ -246,13 +248,13 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (subCommand == null) {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Argument.Unrecognised.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
return true;
}
if (!subCommand.hasPermission(sender, isAdmin)) {
messageManager.sendMessage(sender, configLoad.getString("Command.PermissionDenied." + (isAdmin ? "Admin" : "Island") + ".Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return true;
}
@ -402,7 +404,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (nextEndIndex <= -7) {
skyblock.getMessageManager().sendMessage(player, configLoad.getString("Command.Island.Help.Page.Message"));
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
return;
}
@ -530,7 +532,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
}
}
skyblock.getSoundManager().playSound(player, Sounds.ARROW_HIT.bukkitSound(), 1.0F, 1.0F);
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_ARROW_HIT.getSound(), 1.0F, 1.0F);
}
public void sendConsoleHelpCommands(CommandSender sender) {

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -10,7 +11,6 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@ -73,11 +73,11 @@ public class AddUpgradeCommand extends SubCommand {
if (islandOwnerUUID == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Island.Owner.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else if (upgrade == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Exist.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else {
if (islandManager.containsIsland(islandOwnerUUID)) {
Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
@ -85,7 +85,7 @@ public class AddUpgradeCommand extends SubCommand {
if (island.hasUpgrade(upgrade)) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Already.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -98,7 +98,7 @@ public class AddUpgradeCommand extends SubCommand {
if (!fileManager.isFileExist(islandDataFile)) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Island.Data.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -108,7 +108,7 @@ public class AddUpgradeCommand extends SubCommand {
if (islandDataConfigLoad.getString("Upgrade." + upgrade.name()) != null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Already.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -125,12 +125,12 @@ public class AddUpgradeCommand extends SubCommand {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Added.Message")
.replace("%player", targetPlayerName).replace("%upgrade", upgrade.name()));
soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Invalid.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,10 +1,10 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.menus.admin.Creator;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
@ -20,7 +20,7 @@ public class CreateCommand extends SubCommand {
}
Creator.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -9,7 +10,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -66,7 +66,7 @@ public class DeleteCommand extends SubCommand {
if (targetPlayerUUID == null || !islandManager.isIslandExist(targetPlayerUUID)) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Delete.Owner.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
Island island = islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(targetPlayerUUID));
Location spawnLocation = LocationUtil.getSpawnLocation();
@ -74,7 +74,7 @@ public class DeleteCommand extends SubCommand {
if (spawnLocation != null && islandManager.isLocationAtIsland(island, spawnLocation)) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Delete.Spawn.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
islandManager.unloadIsland(island, null);
@ -86,7 +86,7 @@ public class DeleteCommand extends SubCommand {
|| island.hasRole(IslandRole.Operator, all.getUniqueId())) {
all.sendMessage(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Command.Island.Confirmation.Deletion.Broadcast.Message")));
soundManager.playSound(all, Sounds.EXPLODE.bukkitSound(), 10.0F, 10.0F);
soundManager.playSound(all, CompatibleSound.ENTITY_GENERIC_EXPLODE.getSound(), 10.0F, 10.0F);
}
}
@ -96,11 +96,11 @@ public class DeleteCommand extends SubCommand {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Delete.Deleted.Message").replace("%player",
targetPlayerName));
soundManager.playSound(sender, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Delete.Invalid.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -7,7 +8,6 @@ import com.songoda.skyblock.menus.admin.Generator;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -28,14 +28,14 @@ public class GeneratorCommand extends SubCommand {
if (skyblock.getGeneratorManager() == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Generator.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
if (playerDataManager.hasPlayerData(player)) {
playerDataManager.getPlayerData(player).setViewer(null);
}
Generator.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,9 +1,9 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.menus.admin.Levelling;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
@ -14,7 +14,7 @@ public class LevelCommand extends SubCommand {
SoundManager soundManager = skyblock.getSoundManager();
Levelling.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
@ -7,7 +8,6 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.levelling.rework.IslandLevelManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
@ -41,7 +41,7 @@ public class LevelScanCommand extends SubCommand {
if (args.length == 0) {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.LevelScan.Invalid.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -50,14 +50,14 @@ public class LevelScanCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.LevelScan.NoIsland.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
levellingManager.startScan(sender instanceof Player ? (Player) sender : null, island);
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.LevelScan.Started.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -7,7 +8,6 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@ -57,12 +57,12 @@ public class OwnerCommand extends SubCommand {
if (islandOwnerUUID == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Owner.Island.None.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else if (islandOwnerUUID.equals(targetPlayerUUID)) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Owner.Island.Owner.Message").replace("%player",
targetPlayerName));
soundManager.playSound(sender, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
} else {
targetPlayer = Bukkit.getServer().getPlayer(islandOwnerUUID);
@ -75,11 +75,11 @@ public class OwnerCommand extends SubCommand {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Owner.Island.Member.Message")
.replace("%player", targetPlayerName).replace("%owner", islandOwnerName));
soundManager.playSound(sender, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Owner.Invalid.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,15 +1,13 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -48,14 +46,14 @@ public class ProxyCommand extends SubCommand {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Proxy.IsOffPlayer.Message")
.replace("%player", targetPlayerOffline.getName()));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
islandManager.removeProxyingPlayer(((Player)sender).getUniqueId());
} else {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Proxy.IsOn.Message")
.replace("%player", targetPlayerOffline.getName()));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
islandManager.addProxiedPlayer(((Player)sender).getUniqueId(), targetPlayerOffline.getUniqueId());
}
@ -64,7 +62,7 @@ public class ProxyCommand extends SubCommand {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Proxy.IsOff.Message")
.replace("%player", ""));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
islandManager.removeProxyingPlayer(((Player)sender).getUniqueId());
}

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.leaderboard.LeaderboardManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@ -45,7 +45,7 @@ public class RefreshHologramsCommand extends SubCommand {
});
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.RefreshHolograms.Refreshed.Message"));
soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -3,6 +3,8 @@ package com.songoda.skyblock.command.commands.admin;
import java.io.File;
import java.util.Map;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.island.reward.RewardManager;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@ -20,7 +22,6 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.scoreboard.ScoreboardManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.item.MenuClickRegistry;
import com.songoda.skyblock.utils.version.Sounds;
public class ReloadCommand extends SubCommand {
@ -84,6 +85,9 @@ public class ReloadCommand extends SubCommand {
IslandLevelManager levellingManager = skyblock.getLevellingManager();
levellingManager.reloadWorth();
RewardManager rewardManager = skyblock.getRewardManager();
rewardManager.loadRewards();
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
leaderboardManager.clearLeaderboard();
leaderboardManager.resetLeaderboard();
@ -97,7 +101,7 @@ public class ReloadCommand extends SubCommand {
MenuClickRegistry.getInstance().reloadAll();
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Reload.Reloaded.Message"));
soundManager.playSound(sender, Sounds.ANVIL_USE.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_USE.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -8,7 +9,6 @@ import com.songoda.skyblock.hologram.HologramManager;
import com.songoda.skyblock.hologram.HologramType;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
@ -62,7 +62,7 @@ public class RemoveHologramCommand extends SubCommand {
if (locationsConfigLoad.getString("Location.Hologram.Leaderboard." + hologramType.name()) == null) {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.RemoveHologram.Set.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
locationsConfigLoad.set("Location.Hologram.Leaderboard." + hologramType.name(), null);
@ -82,7 +82,7 @@ public class RemoveHologramCommand extends SubCommand {
});
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.RemoveHologram.Removed.Message").replace("%type", hologramType.name()));
soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
return;
@ -90,7 +90,7 @@ public class RemoveHologramCommand extends SubCommand {
}
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.RemoveHologram.Invalid.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -10,7 +11,6 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@ -73,11 +73,11 @@ public class RemoveUpgradeCommand extends SubCommand {
if (islandOwnerUUID == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.RemoveUpgrade.Island.Owner.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else if (upgrade == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.RemoveUpgrade.Upgrade.Exist.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else {
if (islandManager.containsIsland(islandOwnerUUID)) {
Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
@ -85,7 +85,7 @@ public class RemoveUpgradeCommand extends SubCommand {
if (!island.hasUpgrade(upgrade)) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.RemoveUpgrade.Upgrade.Missing.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -98,7 +98,7 @@ public class RemoveUpgradeCommand extends SubCommand {
if (!fileManager.isFileExist(islandDataFile)) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.RemoveUpgrade.Island.Data.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -108,7 +108,7 @@ public class RemoveUpgradeCommand extends SubCommand {
if (islandDataConfigLoad.getString("Upgrade." + upgrade.name()) == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.RemoveUpgrade.Upgrade.Missing.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -125,12 +125,12 @@ public class RemoveUpgradeCommand extends SubCommand {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.RemoveUpgrade.Removed.Message")
.replace("%player", targetPlayerName).replace("%upgrade", upgrade.name()));
soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.RemoveUpgrade.Invalid.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -3,6 +3,7 @@ package com.songoda.skyblock.command.commands.admin;
import java.io.File;
import java.util.UUID;
import com.songoda.core.compatibility.CompatibleSound;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@ -18,7 +19,6 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
public class SetAlwaysLoadedCommand extends SubCommand {
@ -66,13 +66,13 @@ public class SetAlwaysLoadedCommand extends SubCommand {
if (island.isAlwaysLoaded()) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetAlwaysLoaded.IsOff.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
island.setAlwaysLoaded(false);
} else {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetAlwaysLoaded.IsOn.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
island.setAlwaysLoaded(true);
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.biome.BiomeManager;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
@ -11,7 +12,6 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.SBiome;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@ -72,7 +72,7 @@ public class SetBiomeCommand extends SubCommand {
if (islandOwnerUUID == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetBiome.Island.Owner.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else {
if (islandManager.containsIsland(islandOwnerUUID)) {
Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
@ -83,7 +83,7 @@ public class SetBiomeCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetBiome.Island.Data.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
biomeManager.setBiome(island, biome.getBiome());
island.setBiome(biome.getBiome());
@ -94,17 +94,17 @@ public class SetBiomeCommand extends SubCommand {
configLoad.getString("Command.Island.Admin.SetBiome.Set.Message")
.replace("%player", targetPlayerName)
.replace("%biome", biome.getFormattedBiomeName()));
soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetBiome.InvalidBiome.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetBiome.Invalid.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -8,7 +9,6 @@ import com.songoda.skyblock.hologram.HologramManager;
import com.songoda.skyblock.hologram.HologramType;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
@ -65,7 +65,7 @@ public class SetHologramCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.SetHologram.Set.Message").replace("%type",
hologramType.name()));
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
return;
}
@ -73,7 +73,7 @@ public class SetHologramCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.SetHologram.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -10,7 +11,6 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@ -64,15 +64,15 @@ public class SetSizeCommand extends SubCommand {
if (islandOwnerUUID == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetSize.Island.Owner.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
} else if (size < 50) {
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else if (size < 20) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetSize.Size.Greater.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else if (size > 1000) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetSize.Size.Less.Message"));
soundManager.playSound(sender, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else {
if (islandManager.containsIsland(islandOwnerUUID)) {
Island island = islandManager
@ -91,7 +91,7 @@ public class SetSizeCommand extends SubCommand {
if (!fileManager.isFileExist(islandDataFile)) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetSize.Island.Data.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -111,17 +111,17 @@ public class SetSizeCommand extends SubCommand {
configLoad.getString("Command.Island.Admin.SetSize.Set.Message")
.replace("%player", targetPlayerName)
.replace("%size", NumberUtil.formatNumberByDecimal(size)));
soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetSize.Numerical.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetSize.Invalid.Message"));
soundManager.playSound(sender, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -26,7 +26,7 @@ public class SetSpawnCommand extends SubCommand {
fileManager.setLocation(fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")),
"Location.Spawn", player.getLocation(), true);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.SetSpawn.Set.Message"));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -1,9 +1,9 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.menus.admin.Settings;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
@ -14,7 +14,7 @@ public class SettingsCommand extends SubCommand {
SoundManager soundManager = skyblock.getSoundManager();
Settings.getInstance().open(player, Settings.Type.Categories, null);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -3,6 +3,7 @@ package com.songoda.skyblock.command.commands.admin;
import java.io.File;
import java.util.Set;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -14,7 +15,7 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.stackable.Stackable;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.StringUtil;
import com.songoda.skyblock.utils.version.Materials;
public class StackableCommand extends SubCommand {
@ -46,7 +47,7 @@ public class StackableCommand extends SubCommand {
return;
}
final Block block = player.getTargetBlock((Set<Material>) null, 6);
final Block block = player.getTargetBlock(null, 6);
if (block == null) {
messageManager.sendMessage(player, messageConfig.getString("Command.Island.Admin.Stackable.Target.None"));
@ -54,7 +55,7 @@ public class StackableCommand extends SubCommand {
}
final StackableManager stackableManager = skyblock.getStackableManager();
final Materials type = Materials.getMaterials(block.getType(), block.getData());
final CompatibleMaterial type = CompatibleMaterial.getMaterial(block.getType());
if (!stackableManager.isStackableMaterial(type)) {
messageManager.sendMessage(player, messageConfig.getString("Command.Island.Admin.Stackable.Target.Unstackable"));

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.google.gson.Gson;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.message.MessageManager;
@ -8,13 +8,9 @@ import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.skyblock.utils.Compression;
import com.songoda.skyblock.utils.structure.Storage;
import com.songoda.skyblock.utils.structure.Structure;
import com.songoda.skyblock.utils.structure.StructureUtil;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ComponentBuilder;
@ -109,7 +105,7 @@ public class StructureCommand extends SubCommand {
}
}
soundManager.playSound(player, Sounds.ARROW_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_ARROW_HIT.getSound(), 1.0F, 1.0F);
} else {
if (args[0].equalsIgnoreCase("tool")) {
try {
@ -121,7 +117,7 @@ public class StructureCommand extends SubCommand {
.getItemMeta().getDisplayName().equals(is.getItemMeta().getDisplayName()))) {
messageManager.sendMessage(player, configLoad
.getString("Command.Island.Admin.Structure.Tool.Inventory.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -131,11 +127,11 @@ public class StructureCommand extends SubCommand {
player.getInventory().addItem(is);
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Tool.Equiped.Message"));
soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_CHICKEN_EGG.getSound(), 1.0F, 1.0F);
} catch (Exception e) {
messageManager.sendMessage(player,
configLoad.getString("Island.Structure.Tool.Material.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
Bukkit.getServer().getLogger().log(Level.WARNING,
"SkyBlock | Error: The defined material in the configuration file for the Structure selection tool could not be found.");
@ -152,26 +148,26 @@ public class StructureCommand extends SubCommand {
if (position1Location == null && position2Location == null) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Save.Position.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if ((position1Location == null && position2Location != null)
|| (position1Location != null && position2Location == null)) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Save.Complete.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (!position1Location.getWorld().getName()
.equals(position2Location.getWorld().getName())) {
messageManager.sendMessage(player, configLoad
.getString("Command.Island.Admin.Structure.Save.Selection.World.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (!player.getWorld().getName().equals(position1Location.getWorld().getName())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Save.Player.World.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (!LocationUtil.isInsideArea(player.getLocation(), position1Location,
position2Location)) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Save.Player.Area.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
try {
File configFile = new File(
@ -184,20 +180,22 @@ public class StructureCommand extends SubCommand {
.getString(
"Command.Island.Admin.Structure.Save.Saved.Successful.Message")
.replace("%name", args[1]));
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
return;
} catch (Exception e) {
messageManager.sendMessage(player, configLoad
.getString("Command.Island.Admin.Structure.Save.Saved.Failed.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
e.printStackTrace();
}
}
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Save.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else if (args[0].equalsIgnoreCase("convert")) {
if (args.length == 2) {
File structureFile = new File(new File(skyblock.getDataFolder().toString() + "/structures"), args[1]);
@ -205,7 +203,7 @@ public class StructureCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Convert.Invalid.Message")
.replace("%name", args[1]));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
byte[] content = new byte[(int) structureFile.length()];
@ -226,26 +224,26 @@ public class StructureCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Convert.Converted.Failed.Message")
.replace("%name", args[1]));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
e.printStackTrace();
}
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Convert.Converted.Successful.Message")
.replace("%name", args[1]));
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Convert.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
return;
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Argument.Unrecognised.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
messageManager.sendMessage(player, configLoad.getString("Command.Island.Argument.Unrecognised.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -7,7 +8,6 @@ import com.songoda.skyblock.menus.admin.Upgrade;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -28,13 +28,13 @@ public class UpgradeCommand extends SubCommand {
if (skyblock.getUpgradeManager() == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Upgrade.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
if (playerDataManager.hasPlayerData(player)) {
playerDataManager.getPlayerData(player)
.setViewer(new Upgrade.Viewer(Upgrade.Viewer.Type.Upgrades, null));
Upgrade.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.api.event.player.PlayerIslandJoinEvent;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
@ -15,7 +16,6 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.scoreboard.Scoreboard;
import com.songoda.skyblock.scoreboard.ScoreboardManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
@ -25,7 +25,6 @@ import org.bukkit.entity.Player;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@ -83,13 +82,13 @@ public class AcceptCommand extends SubCommand {
messageManager.sendMessage(targetPlayer,
configLoad.getString("Command.Island.Accept.Accepted.Target.Message")
.replace("%player", player.getName()));
soundManager.playSound(targetPlayer, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
}
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Accept.Accepted.Sender.Message")
.replace("%player", invite.getSenderName()));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
playerData.setPlaytime(0);
playerData.setOwner(invite.getOwnerUUID());
@ -119,7 +118,7 @@ public class AcceptCommand extends SubCommand {
"Command.Island.Accept.Capacity.Broadcast.Message")
.replace("%player", targetInvite.getSenderName())));
soundManager.playSound(targetInvitePlayer,
Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
}
}
}
@ -140,7 +139,7 @@ public class AcceptCommand extends SubCommand {
.getString(
"Command.Island.Accept.Accepted.Broadcast.Message")
.replace("%player", player.getName())));
soundManager.playSound(all, Sounds.FIREWORK_BLAST.bukkitSound(), 1.0F,
soundManager.playSound(all, CompatibleSound.ENTITY_FIREWORK_ROCKET_BLAST.getSound(), 1.0F,
1.0F);
if (scoreboardManager != null) {
@ -187,19 +186,19 @@ public class AcceptCommand extends SubCommand {
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Accept.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Accept.Invited.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Accept.Invite.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Accept.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -3,6 +3,7 @@ package com.songoda.skyblock.command.commands.island;
import java.io.File;
import java.util.UUID;
import com.songoda.core.compatibility.CompatibleSound;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -18,7 +19,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
public class BanCommand extends SubCommand {
@ -39,7 +39,7 @@ public class BanCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Banning")) {
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId()) && island.getSetting(IslandRole.Operator, "Ban").getStatus())) {
@ -60,21 +60,21 @@ public class BanCommand extends SubCommand {
if (targetPlayerUUID == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Found.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (targetPlayerUUID.equals(player.getUniqueId())) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Yourself.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Member, targetPlayerUUID) || island.hasRole(IslandRole.Operator, targetPlayerUUID)
|| island.hasRole(IslandRole.Owner, targetPlayerUUID)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else
if (island.getBan().isBanned(targetPlayerUUID)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Already.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Banned.Sender.Message").replace("%player", targetPlayerName));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
if (island.isCoopPlayer(targetPlayerUUID)) {
island.removeCoopPlayer(targetPlayerUUID);
@ -87,7 +87,7 @@ public class BanCommand extends SubCommand {
if (targetPlayer != null) {
if (islandManager.isPlayerAtIsland(island, targetPlayer)) {
messageManager.sendMessage(targetPlayer, configLoad.getString("Command.Island.Ban.Banned.Target.Message").replace("%player", player.getName()));
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
LocationUtil.teleportPlayerToSpawn(targetPlayer);
}
@ -95,15 +95,15 @@ public class BanCommand extends SubCommand {
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
});
}

View File

@ -1,17 +1,16 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.utils.VaultPermissions;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -32,13 +31,13 @@ public class BankCommand extends SubCommand {
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.Enable")) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
if (args.length == 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -46,7 +45,7 @@ public class BankCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Unknown.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -54,7 +53,7 @@ public class BankCommand extends SubCommand {
&& !island.hasRole(IslandRole.Owner, player.getUniqueId())
&& !island.hasRole(IslandRole.Member, player.getUniqueId())) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Perm.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -69,7 +68,7 @@ public class BankCommand extends SubCommand {
case "deposit": {
if (args.length == 1) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short3.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -81,7 +80,7 @@ public class BankCommand extends SubCommand {
// Make sure the amount is positive
if (amt <= 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short5.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -90,19 +89,19 @@ public class BankCommand extends SubCommand {
int intAmt = (int) amt;
if (intAmt != amt) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short6.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
}
} catch (NumberFormatException ex) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short4.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
if (!EconomyManager.hasBalance(player, amt)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
EconomyManager.withdrawBalance(player, amt);
@ -114,7 +113,7 @@ public class BankCommand extends SubCommand {
case "withdraw": {
if (args.length == 1) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short3.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -126,7 +125,7 @@ public class BankCommand extends SubCommand {
// Make sure the amount is positive
if (amt <= 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short5.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -135,13 +134,13 @@ public class BankCommand extends SubCommand {
int intAmt = (int) amt;
if (intAmt != amt) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short6.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
}
} catch (NumberFormatException ex) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short4.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -158,7 +157,7 @@ public class BankCommand extends SubCommand {
}
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -7,7 +8,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.menus.Bans;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -28,20 +28,20 @@ public class BansCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bans.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Unban").getStatus())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (island.getBan().getBans().size() == 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bans.Bans.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
Bans.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bans.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -8,7 +9,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.menus.Biome;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -30,15 +30,15 @@ public class BiomeCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Biome.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Biome").getStatus())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
Biome.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Biome.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -9,7 +10,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.menus.Border;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -32,21 +32,21 @@ public class BorderCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Border.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Border").getStatus())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.WorldBorder.Enable")) {
Border.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Border.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Border.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.invite.Invite;
@ -9,7 +10,6 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -34,7 +34,7 @@ public class CancelCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Cancel.Owner.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| island.hasRole(IslandRole.Operator, player.getUniqueId())) {
String playerName = args[0];
@ -42,12 +42,12 @@ public class CancelCommand extends SubCommand {
if (targetPlayer == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Cancel.Offline.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Member, targetPlayer.getUniqueId())
|| island.hasRole(IslandRole.Operator, targetPlayer.getUniqueId())
|| island.hasRole(IslandRole.Owner, targetPlayer.getUniqueId())) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Cancel.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (inviteManager.hasInvite(targetPlayer.getUniqueId())) {
Invite invite = inviteManager.getInvite(targetPlayer.getUniqueId());
@ -57,23 +57,23 @@ public class CancelCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Cancel.Cancelled.Message").replace("%player",
targetPlayer.getName()));
soundManager.playSound(player, Sounds.EXPLODE.bukkitSound(), 10.0F, 10.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_GENERIC_EXPLODE.getSound(), 10.0F, 10.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Cancel.Invited.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Cancel.Invited.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Cancel.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Cancel.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -0,0 +1,109 @@
package com.songoda.skyblock.command.commands.island;
import java.io.File;
import com.songoda.core.compatibility.CompatibleSound;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import com.songoda.skyblock.challenge.FabledChallenge;
import com.songoda.skyblock.challenge.challenge.Challenge;
import com.songoda.skyblock.challenge.challenge.ChallengeCategory;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
public class ChallengeCommand extends SubCommand {
@Override
public void onCommandByPlayer(Player player, String[] args) {
MessageManager messageManager = skyblock.getMessageManager();
SoundManager soundManager = skyblock.getSoundManager();
FileManager fileManager = skyblock.getFileManager();
FabledChallenge fabledChallenge = skyblock.getFabledChallenge();
Config langConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
FileConfiguration langConfigLoad = langConfig.getFileConfiguration();
// Not loaded
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Challenge.Enable")) {
messageManager.sendMessage(player, langConfigLoad.getString("Command.Island.Challenge.Disabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
if (args.length == 0) {
// Open challenge inventory
ChallengeCategory cc = fabledChallenge.getChallengeManager().getChallenge(1);
if (cc == null) {
messageManager.sendMessage(player,
langConfigLoad.getString("Command.Island.Challenge.NotFound.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
fabledChallenge.openChallengeInventory(player, fabledChallenge.getChallengeManager().getChallenge(1));
return;
}
if (args.length == 2) {
// Complete a challenge
int ccId = 0;
int cId = 0;
try {
ccId = Integer.parseInt(args[0]);
cId = Integer.parseInt(args[1]);
} catch (NumberFormatException ex) {
messageManager.sendMessage(player,
langConfigLoad.getString("Command.Island.Challenge.Invalid.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_HURT.getSound(), 1.0F, 1.0F);
return;
}
ChallengeCategory cc = fabledChallenge.getChallengeManager().getChallenge(ccId);
if (cc == null) {
messageManager.sendMessage(player,
langConfigLoad.getString("Command.Island.Challenge.CategoryNotFound.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_HURT.getSound(), 1.0F, 1.0F);
return;
}
Challenge c = cc.getChallenge(cId);
if (c == null) {
messageManager.sendMessage(player,
langConfigLoad.getString("Command.Island.Challenge.ChallengeNotFound.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_HURT.getSound(), 1.0F, 1.0F);
return;
}
if (fabledChallenge.getPlayerManager().doChallenge(player, c))
// Ok
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
else
soundManager.playSound(player, CompatibleSound.BLOCK_GLASS_BREAK.getSound(), 1.0F, 1.0F);
}
}
@Override
public void onCommandByConsole(ConsoleCommandSender sender, String[] args) {
sender.sendMessage("SkyBlock | Error: You must be a player to perform that command.");
}
@Override
public String getName() {
return "challenge";
}
@Override
public String getInfoMessagePath() {
return "Command.Island.Challenge.Info.Message";
}
@Override
public String[] getAliases() {
return new String[] { "c" };
}
@Override
public String[] getArguments() {
return new String[0];
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.api.event.player.PlayerIslandChatSwitchEvent;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
@ -10,7 +11,6 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -39,26 +39,26 @@ public class ChatCommand extends SubCommand {
playerData.setChat(false);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Untoggled.Message"));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
return;
}
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 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) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Team.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if ((islandManager.getMembersOnline(island).size() - 1) <= 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Chat.Offline.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 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, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -7,7 +8,6 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -29,7 +29,7 @@ public class CloseCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Close.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Visitor").getStatus())) {
@ -37,14 +37,14 @@ public class CloseCommand extends SubCommand {
islandManager.closeIsland(island);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Close.Closed.Message"));
soundManager.playSound(player, Sounds.DOOR_CLOSE.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_WOODEN_DOOR_CLOSE.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Close.Already.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Close.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.confirmation.Confirmation;
import com.songoda.skyblock.cooldown.CooldownType;
import com.songoda.skyblock.utils.VaultPermissions;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
@ -17,7 +17,6 @@ import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.structure.Structure;
import com.songoda.skyblock.structure.StructureManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -52,7 +51,7 @@ public class ConfirmCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Confirmation.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
Confirmation confirmation = playerData.getConfirmation();
@ -76,7 +75,7 @@ public class ConfirmCommand extends SubCommand {
targetPlayerName = targetPlayer.getName();
messageManager.sendMessage(targetPlayer, configLoad
.getString("Command.Island.Confirmation.Ownership.Assigned.Message"));
soundManager.playSound(targetPlayer, Sounds.ANVIL_USE.bukkitSound(), 1.0F,
soundManager.playSound(targetPlayer, CompatibleSound.BLOCK_ANVIL_USE.getSound(), 1.0F,
1.0F);
}
@ -90,7 +89,7 @@ public class ConfirmCommand extends SubCommand {
configLoad.getString(
"Command.Island.Ownership.Assigned.Broadcast.Message")
.replace("%player", targetPlayerName)));
soundManager.playSound(all, Sounds.ANVIL_USE.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(all, CompatibleSound.BLOCK_ANVIL_USE.getSound(), 1.0F, 1.0F);
}
}
@ -105,7 +104,7 @@ public class ConfirmCommand extends SubCommand {
} else {
messageManager.sendMessage(player, configLoad
.getString("Command.Island.Confirmation.Ownership.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else if (confirmation == Confirmation.Reset) {
playerData.setConfirmation(null);
@ -114,7 +113,7 @@ public class ConfirmCommand extends SubCommand {
if (island.isOpen()) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Confirmation.Deletion.Open.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
Location spawnLocation = LocationUtil.getSpawnLocation();
@ -122,7 +121,7 @@ public class ConfirmCommand extends SubCommand {
&& islandManager.isLocationAtIsland(island, spawnLocation)) {
messageManager.sendMessage(player, configLoad
.getString("Command.Island.Confirmation.Deletion.Spawn.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -141,7 +140,7 @@ public class ConfirmCommand extends SubCommand {
configLoad.getString(
"Command.Island.Confirmation.Deletion.Money.Message")
.replace("%cost", "" + deletionCost));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F,
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F,
1.0F);
return;
@ -161,34 +160,34 @@ public class ConfirmCommand extends SubCommand {
all.sendMessage(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Command.Island.Confirmation.Deletion.Broadcast.Message")));
soundManager.playSound(all, Sounds.EXPLODE.bukkitSound(), 10.0F, 10.0F);
soundManager.playSound(all, CompatibleSound.ENTITY_GENERIC_EXPLODE.getSound(), 10.0F, 10.0F);
}
}
if (islandManager.deleteIsland(island, false)) {
island.setDeleted(true);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Confirmation.Deletion.Sender.Message"));
soundManager.playSound(player, Sounds.EXPLODE.bukkitSound(), 10.0F, 10.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_GENERIC_EXPLODE.getSound(), 10.0F, 10.0F);
}else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Confirmation.Deletion.Sender.MaxDeletionMessage"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1f, 1f);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1f, 1f);
}
}
}
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Confirmation.Role.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Confirmation.Specified.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Confirmation.Pending.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,10 +1,10 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.menus.ControlPanel;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -23,10 +23,10 @@ public class ControlPanelCommand extends SubCommand {
if (skyblock.getIslandManager().getIsland(player) == null) {
skyblock.getMessageManager().sendMessage(player,
configLoad.getString("Command.Island.ControlPanel.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
ControlPanel.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -11,7 +12,6 @@ import com.songoda.skyblock.menus.Coop;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
@ -39,7 +39,7 @@ public class CoopCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Coop.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Coop.Enable")) {
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
@ -67,19 +67,19 @@ public class CoopCommand extends SubCommand {
if (targetPlayerUUID == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Coop.Found.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (targetPlayerUUID.equals(player.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Coop.Yourself.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Member, targetPlayerUUID)
|| island.hasRole(IslandRole.Operator, targetPlayerUUID)
|| island.hasRole(IslandRole.Owner, targetPlayerUUID)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Coop.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.getBan().isBanned(targetPlayerUUID)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Coop.Banned.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.isCoopPlayer(targetPlayerUUID)) {
if (targetPlayer != null) {
if (islandManager.getVisitorsAtIsland(island).contains(targetPlayerUUID)) {
@ -88,7 +88,7 @@ public class CoopCommand extends SubCommand {
messageManager.sendMessage(targetPlayer,
configLoad.getString("Command.Island.Coop.Removed.Target.Message"));
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F,
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F,
1.0F);
}
}
@ -99,7 +99,7 @@ public class CoopCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Coop.Removed.Sender.Message").replace("%player",
targetPlayerName));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
} else {
IslandCoop type = IslandCoop.NORMAL;
if (args.length == 2 && args[1].equalsIgnoreCase(temp))
@ -115,26 +115,26 @@ public class CoopCommand extends SubCommand {
.replace("%player", player.getName()));
}
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
return;
} else if (args.length != 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Coop.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
Coop.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Coop.Permission.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Coop.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -13,7 +14,6 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.structure.Structure;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -33,19 +33,28 @@ public class CreateCommand extends SubCommand {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (islandManager.getIsland(player) == null) {
Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
if (mainConfig.getFileConfiguration().getBoolean("Island.Creation.Menu.Enable")) {
if (args.length == 1) {
Structure structure = skyblock.getStructureManager().getStructure(args[0]);
if (structure != null && islandManager.createIsland(player, structure)) {
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.Created.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
} else if (structure == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Create.StructureNotFound.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else if (mainConfig.getFileConfiguration().getBoolean("Island.Creation.Menu.Enable")) {
Creator.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
} else {
List<Structure> structures = skyblock.getStructureManager().getStructures();
if (structures.size() == 0) {
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.None.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (!fileManager
@ -53,7 +62,7 @@ public class CreateCommand extends SubCommand {
structures.get(0).getOverworldFile()))) {
messageManager.sendMessage(player,
configLoad.getString("Island.Creator.Selector.File.Overworld.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (!fileManager
@ -61,7 +70,7 @@ public class CreateCommand extends SubCommand {
structures.get(0).getNetherFile()))) {
messageManager.sendMessage(player,
configLoad.getString("Island.Creator.Selector.File.Nether.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
@ -86,19 +95,19 @@ public class CreateCommand extends SubCommand {
.getString("Island.Creator.Selector.Cooldown.Word.Second")));
}
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
return;
}
if (islandManager.createIsland(player, structures.get(0))) {
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.Created.Message"));
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Create.Owner.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.message.MessageManager;
@ -7,7 +8,6 @@ import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -34,7 +34,7 @@ public class CurrentCommand extends SubCommand {
if (targetPlayer == null) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Current.Offline.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -61,14 +61,14 @@ public class CurrentCommand extends SubCommand {
.replace("%owner", ownerPlayerName));
}
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
return;
}
} else if (args.length > 1) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Current.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -95,7 +95,7 @@ public class CurrentCommand extends SubCommand {
targetPlayerName));
}
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
}
@Override

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -11,7 +12,6 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.skyblock.utils.version.Sounds;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
@ -42,12 +42,12 @@ public class DeleteCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Delete.Owner.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (playerData.getConfirmationTime() > 0) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Delete.Confirmation.Pending.Message"));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
} else {
int confirmationTime = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Confirmation.Timeout");
@ -118,11 +118,11 @@ public class DeleteCommand extends SubCommand {
messageManager.sendMessage(player, confirmationMessage.replace("%time", "" + confirmationTime));
}
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Delete.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -8,7 +9,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -34,7 +34,7 @@ public class DemoteCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Demote.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
@ -47,13 +47,13 @@ public class DemoteCommand extends SubCommand {
if (islandMembers.contains(offlinePlayer.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Demote.Role.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Demote.Demoted.Sender.Message")
.replace("%player", offlinePlayer.getName()));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
island.removeRole(IslandRole.Operator, offlinePlayer.getUniqueId());
island.setRole(IslandRole.Member, offlinePlayer.getUniqueId());
@ -62,7 +62,7 @@ public class DemoteCommand extends SubCommand {
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Demote.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
if (island.hasRole(IslandRole.Member, targetPlayer.getUniqueId())
@ -70,15 +70,15 @@ public class DemoteCommand extends SubCommand {
if (island.hasRole(IslandRole.Member, targetPlayer.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Demote.Role.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Demote.Demoted.Sender.Message")
.replace("%player", targetPlayer.getName()));
messageManager.sendMessage(targetPlayer,
configLoad.getString("Command.Island.Demote.Demoted.Target.Message"));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
island.removeRole(IslandRole.Operator, targetPlayer.getUniqueId());
island.setRole(IslandRole.Member, targetPlayer.getUniqueId());
@ -87,16 +87,16 @@ public class DemoteCommand extends SubCommand {
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Promote.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Demote.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Demote.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.invite.Invite;
import com.songoda.skyblock.invite.InviteManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -37,25 +37,25 @@ public class DenyCommand extends SubCommand {
messageManager.sendMessage(targetPlayer,
configLoad.getString("Command.Island.Deny.Denied.Target.Message").replace("%player",
player.getName()));
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 5.0F, 5.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 5.0F, 5.0F);
}
messageManager.sendMessage(player, configLoad.getString("Command.Island.Deny.Denied.Sender.Message")
.replace("%player", invite.getSenderName()));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 5.0F, 5.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 5.0F, 5.0F);
inviteManager.removeInvite(player.getUniqueId());
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Deny.Invited.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Deny.Invited.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Deny.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.IslandManager;
@ -9,7 +10,6 @@ import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -46,13 +46,13 @@ public class InformationCommand extends SubCommand {
if (islandOwnerUUID == null) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Information.Island.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
} else if (args.length != 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Information.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -63,7 +63,7 @@ public class InformationCommand extends SubCommand {
if (islandManager.getIsland(player) == null) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Information.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else {
@ -73,7 +73,7 @@ public class InformationCommand extends SubCommand {
playerData.setViewer(new Information.Viewer(islandOwnerUUID, Information.Viewer.Type.Categories));
Information.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.api.event.island.IslandInviteEvent;
import com.songoda.skyblock.api.invite.IslandInvitation;
import com.songoda.skyblock.command.SubCommand;
@ -12,7 +13,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.skyblock.utils.version.Sounds;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
@ -43,7 +43,7 @@ public class InviteCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Invite.Owner.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Invite").getStatus())) {
@ -52,42 +52,42 @@ public class InviteCommand extends SubCommand {
if ((island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size()
+ 1) >= mainConfig.getFileConfiguration().getInt("Island.Member.Capacity")) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Invite.Capacity.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
String playerName = args[0];
if (playerName.equalsIgnoreCase(player.getName())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Invite.Yourself.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
Player targetPlayer = Bukkit.getServer().getPlayer(playerName);
if (targetPlayer == null) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Invite.Offline.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (targetPlayer.getName().equalsIgnoreCase(player.getName())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Invite.Yourself.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Member, targetPlayer.getUniqueId())
|| island.hasRole(IslandRole.Operator, targetPlayer.getUniqueId())
|| island.hasRole(IslandRole.Owner, targetPlayer.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Invite.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (skyblock.getInviteManager().hasInvite(targetPlayer.getUniqueId())) {
Invite invite = skyblock.getInviteManager().getInvite(targetPlayer.getUniqueId());
if (invite.getOwnerUUID().equals(island.getOwnerUUID())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Invite.Already.Own.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Invite.Already.Other.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
int respondTime = mainConfig.getFileConfiguration().getInt("Island.Invite.Time");
@ -220,18 +220,18 @@ public class InviteCommand extends SubCommand {
.callEvent(new IslandInviteEvent(island.getAPIWrapper(),
new IslandInvitation(targetPlayer, player, invite.getTime())));
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
}
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Invite.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Invite.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.api.event.island.IslandKickEvent;
import com.songoda.skyblock.api.utils.APIUtil;
import com.songoda.skyblock.command.SubCommand;
@ -9,7 +10,6 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
@ -35,7 +35,7 @@ public class KickAllCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.KickAll.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Kick").getStatus())) {
@ -44,7 +44,7 @@ public class KickAllCommand extends SubCommand {
if (islandVisitors.size() == 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.KickAll.Visitors.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
for (UUID islandVisitorList : islandVisitors) {
Player targetPlayer = Bukkit.getServer().getPlayer(islandVisitorList);
@ -63,22 +63,22 @@ public class KickAllCommand extends SubCommand {
messageManager.sendMessage(targetPlayer,
configLoad.getString("Command.Island.KickAll.Kicked.Target.Message")
.replace("%player", player.getName()));
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
}
}
messageManager.sendMessage(player,
configLoad.getString("Command.Island.KickAll.Kicked.Sender.Message").replace("%visitors",
"" + islandVisitors.size()));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.KickAll.Closed.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.KickAll.Role.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import java.util.Set;
import java.util.UUID;
import com.songoda.core.compatibility.CompatibleSound;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
@ -26,7 +27,6 @@ import com.songoda.skyblock.scoreboard.Scoreboard;
import com.songoda.skyblock.scoreboard.ScoreboardManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
public class KickCommand extends SubCommand {
@ -50,7 +50,7 @@ public class KickCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId()) && island.getSetting(IslandRole.Operator, "Kick").getStatus())) {
UUID targetPlayerUUID = null;
@ -72,17 +72,17 @@ public class KickCommand extends SubCommand {
if (targetPlayerUUID.equals(player.getUniqueId())) {
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Yourself.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 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)) {
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Role.Operator.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.getOwnerUUID().equals(targetPlayerUUID)) {
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Role.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.isOpen() && islandVisitors.contains(targetPlayerUUID) && targetPlayer != null) {
if (island.isCoopPlayer(targetPlayerUUID)) {
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Cooped.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(), APIUtil.fromImplementation(IslandRole.Visitor),
Bukkit.getServer().getOfflinePlayer(targetPlayerUUID), player);
@ -94,11 +94,11 @@ public class KickCommand extends SubCommand {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Kicked.Sender.Message").replace("%player", targetPlayerName));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(targetPlayer,
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Kicked.Target.Message").replace("%player", player.getName()));
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
}
}
} else if (islandMembers.contains(targetPlayerUUID) || islandOperators.contains(targetPlayerUUID)) {
@ -116,7 +116,7 @@ public class KickCommand extends SubCommand {
if (!islandKickEvent.isCancelled()) {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Kicked.Sender.Message").replace("%player", targetPlayerName));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
if (targetPlayer == null) {
Config config = fileManager.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), targetPlayerUUID.toString() + ".yml"));
@ -134,7 +134,7 @@ public class KickCommand extends SubCommand {
} else {
messageManager.sendMessage(targetPlayer,
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Kicked.Target.Message").replace("%player", player.getName()));
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
if (islandManager.isPlayerAtIsland(island, targetPlayer)) {
LocationUtil.teleportPlayerToSpawn(targetPlayer);
@ -204,7 +204,7 @@ public class KickCommand extends SubCommand {
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Occupant.Visit.Closed.Message"));
}
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
if (island.isOpen()) {
@ -213,11 +213,11 @@ public class KickCommand extends SubCommand {
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Permission.Visit.Closed.Message"));
}
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
});
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -7,7 +8,6 @@ import com.songoda.skyblock.menus.Leaderboard;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -50,24 +50,24 @@ public class LeaderboardCommand extends SubCommand {
playerDataManager.getPlayerData(player).setViewer(new Leaderboard.Viewer(Leaderboard.Viewer.Type.Votes));
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Leaderboard.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
break;
default:
messageManager.sendMessage(player, configLoad.getString("Command.Island.Leaderboard.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Leaderboard.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
Leaderboard.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.api.event.player.PlayerIslandLeaveEvent;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
@ -13,7 +14,6 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.scoreboard.Scoreboard;
import com.songoda.skyblock.scoreboard.ScoreboardManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -44,11 +44,11 @@ public class LeaveCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration().getString("Command.Island.Leave.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration().getString("Command.Island.Leave.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
PlayerIslandLeaveEvent islandLeaveEvent = new PlayerIslandLeaveEvent(player, island.getAPIWrapper());
Bukkit.getServer().getPluginManager().callEvent(islandLeaveEvent);
@ -102,7 +102,7 @@ public class LeaveCommand extends SubCommand {
languageConfig.getFileConfiguration()
.getString("Command.Island.Leave.Left.Broadcast.Message")
.replace("%player", player.getName())));
soundManager.playSound(all, Sounds.IRONGOLEM_HIT.bukkitSound(), 5.0F, 5.0F);
soundManager.playSound(all, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 5.0F, 5.0F);
if (island.getRole(IslandRole.Member).size() == 0
&& island.getRole(IslandRole.Operator).size() == 0) {
@ -126,7 +126,7 @@ public class LeaveCommand extends SubCommand {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration().getString("Command.Island.Leave.Left.Sender.Message"));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 5.0F, 5.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 5.0F, 5.0F);
if (scoreboardManager != null) {
Scoreboard scoreboard = scoreboardManager.getScoreboard(player);

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.cooldown.Cooldown;
@ -15,7 +16,6 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.visit.VisitManager;
import org.bukkit.Bukkit;
@ -58,7 +58,7 @@ public class LevelCommand extends SubCommand {
if (islandOwnerUUID == null) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Level.Owner.Other.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (!islandOwnerUUID.equals(playerDataManager.getPlayerData(player).getOwner())) {
@ -69,20 +69,20 @@ public class LevelCommand extends SubCommand {
configLoad.getString("Command.Island.Level.Level.Message")
.replace("%player", targetPlayerName).replace("%level",
"" + NumberUtil.formatNumberByDecimal(visit.getLevel().getLevel())));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
return;
}
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Level.Owner.Other.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
} else if (args.length != 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -91,7 +91,7 @@ public class LevelCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Owner.Yourself.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
player.closeInventory();
@ -128,20 +128,20 @@ public class LevelCommand extends SubCommand {
+ configLoad.getString("Command.Island.Level.Cooldown.Word.Second")));
}
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
return;
}
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Processing.Message"));
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
cooldownManager.createPlayer(CooldownType.Levelling,
Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()));
levellingManager.startScan(player, island);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Loading.Message"));
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
Levelling.getInstance().open(player);
}
}

View File

@ -1,10 +1,10 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.menus.Members;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
@ -20,7 +20,7 @@ public class MembersCommand extends SubCommand {
skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Command.Island.Settings.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
playerData.setType(Members.Type.Default);
@ -28,7 +28,7 @@ public class MembersCommand extends SubCommand {
Members.getInstance().open(player, (Members.Type) playerData.getType(),
(Members.Sort) playerData.getSort());
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -7,7 +8,6 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -29,22 +29,22 @@ public class OpenCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Open.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Visitor").getStatus())) {
if (island.isOpen()) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Open.Already.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
island.setOpen(true);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Open.Opened.Message"));
soundManager.playSound(player, Sounds.DOOR_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_WOODEN_DOOR_OPEN.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Open.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -18,7 +19,6 @@ import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
@ -52,12 +52,12 @@ public class OwnerCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ownership.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (args.length == 0) {
if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
playerData.setType(Ownership.Visibility.Hidden);
Ownership.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
return;
}
@ -66,7 +66,7 @@ public class OwnerCommand extends SubCommand {
if (playerData.getConfirmationTime() > 0) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Confirmation.Pending.Message"));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
} else {
UUID targetPlayerUUID;
String targetPlayerName;
@ -87,11 +87,11 @@ public class OwnerCommand extends SubCommand {
&& !island.hasRole(IslandRole.Owner, targetPlayerUUID))) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (targetPlayerUUID.equals(player.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Yourself.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (cooldownManager.hasPlayer(CooldownType.Ownership,
Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()))) {
CooldownPlayer cooldownPlayer = cooldownManager.getCooldownPlayer(CooldownType.Ownership,
@ -122,7 +122,7 @@ public class OwnerCommand extends SubCommand {
+ configLoad.getString("Command.Island.Ownership.Cooldown.Word.Second")));
}
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
return;
} else {
@ -201,7 +201,7 @@ public class OwnerCommand extends SubCommand {
.replace("%time", "" + confirmationTime));
}
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
}
}
} else {
@ -215,13 +215,13 @@ public class OwnerCommand extends SubCommand {
all.sendMessage(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Command.Island.Ownership.Assigned.Broadcast.Message")
.replace("%player", player.getName())));
soundManager.playSound(all, Sounds.ANVIL_USE.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(all, CompatibleSound.BLOCK_ANVIL_USE.getSound(), 1.0F, 1.0F);
}
}
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Assigned.Sender.Message"));
soundManager.playSound(player, Sounds.ANVIL_USE.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_USE.getSound(), 1.0F, 1.0F);
islandManager.giveOwnership(island, player);
@ -230,19 +230,19 @@ public class OwnerCommand extends SubCommand {
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Password.Incorrect.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Password.Unset.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}
return;
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ownership.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -0,0 +1,102 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.confirmation.Confirmation;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.structure.Structure;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
public class PreviewCommand extends SubCommand {
@Override
public void onCommandByPlayer(Player player, String[] args) {
FileManager fileManager = skyblock.getFileManager();
FileManager.Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
FileConfiguration configLang = config.getFileConfiguration();
if(args.length != 1) {
skyblock.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.Argument.Count.Message"));
return;
}
PlayerData data = skyblock.getPlayerDataManager().getPlayerData(player);
Island island = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(player.getUniqueId()));
if (args[0].equals("confirm")) {
if(data.getConfirmation() == Confirmation.Preview && data.getConfirmationTime() > 0) {
Structure islandStructure = skyblock.getStructureManager().getStructure(island.getStructure());
if(skyblock.getIslandManager().deleteIsland(island, true)) {
island.setDeleted(true);
data.setPreview(false);
if(player.getGameMode() == GameMode.SPECTATOR) {
player.setGameMode(GameMode.SURVIVAL);
}
Bukkit.getScheduler().runTaskLater(skyblock, () -> {
if(skyblock.getIslandManager().createIsland(player, islandStructure)) {
skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Creator.Selector.Created.Message"));
skyblock.getSoundManager().playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
}, 30L);
}
}
} else if (args[0].equals("cancel")) {
if(data.getConfirmation() == Confirmation.Preview && data.getConfirmationTime() > 0) {
if(skyblock.getIslandManager().deleteIsland(island, true)) {
island.setDeleted(true);
data.setPreview(false);
if (player.getGameMode() == GameMode.SPECTATOR) {
player.setGameMode(GameMode.SURVIVAL);
}
}
}
} else {
// Do not preview if user has an island
if (island != null) {
skyblock.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.Island.Message"));
return;
}
Structure structure = skyblock.getStructureManager().getStructure(args[0]);
if(structure == null) {
skyblock.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.File.Message"));
return;
}
skyblock.getIslandManager().previewIsland(player, structure);
}
}
@Override
public void onCommandByConsole(ConsoleCommandSender sender, String[] args) {
sender.sendMessage("SkyBlock | Error: You must be a player to perform that command.");
}
@Override
public String getName() {
return "preview";
}
@Override
public String getInfoMessagePath() {
return "Command.Island.Preview.Info.Message";
}
@Override
public String[] getAliases() {
return new String[0];
}
@Override
public String[] getArguments() {
return new String[0];
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -8,7 +9,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
@ -32,7 +32,7 @@ public class PromoteCommand extends SubCommand {
if (args.length != 1) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Promote.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -40,13 +40,13 @@ public class PromoteCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Promote.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
if (!island.hasRole(IslandRole.Owner, player.getUniqueId())) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Promote.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
return;
}
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
@ -61,12 +61,12 @@ public class PromoteCommand extends SubCommand {
if (islandOperators.contains(offlinePlayer.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Promote.Operator.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Promote.Promoted.Sender.Message")
.replace("%player", offlinePlayer.getName()));
soundManager.playSound(player, Sounds.FIREWORK_BLAST.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_FIREWORK_ROCKET_BLAST.getSound(), 1.0F, 1.0F);
for (Player all : Bukkit.getOnlinePlayers()) {
if (!all.getUniqueId().equals(player.getUniqueId())) {
@ -77,7 +77,7 @@ public class PromoteCommand extends SubCommand {
configLoad
.getString("Command.Island.Promote.Promoted.Broadcast.Message")
.replace("%player", offlinePlayer.getName())));
soundManager.playSound(all, Sounds.FIREWORK_BLAST.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(all, CompatibleSound.ENTITY_FIREWORK_ROCKET_BLAST.getSound(), 1.0F, 1.0F);
}
}
}
@ -87,7 +87,7 @@ public class PromoteCommand extends SubCommand {
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Promote.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
return;
}
@ -96,16 +96,16 @@ public class PromoteCommand extends SubCommand {
if (island.hasRole(IslandRole.Operator, targetPlayer.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Promote.Operator.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Promote.Promoted.Sender.Message")
.replace("%player", targetPlayer.getName()));
soundManager.playSound(player, Sounds.FIREWORK_BLAST.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_FIREWORK_ROCKET_BLAST.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(targetPlayer,
configLoad.getString("Command.Island.Promote.Promoted.Target.Message"));
soundManager.playSound(targetPlayer, Sounds.FIREWORK_BLAST.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_FIREWORK_ROCKET_BLAST.getSound(), 1.0F, 1.0F);
for (Player all : Bukkit.getOnlinePlayers()) {
if (!all.getUniqueId().equals(player.getUniqueId())) {
@ -116,7 +116,7 @@ public class PromoteCommand extends SubCommand {
configLoad
.getString("Command.Island.Promote.Promoted.Broadcast.Message")
.replace("%player", targetPlayer.getName())));
soundManager.playSound(all, Sounds.FIREWORK_BLAST.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(all, CompatibleSound.ENTITY_FIREWORK_ROCKET_BLAST.getSound(), 1.0F, 1.0F);
}
}
}
@ -126,7 +126,7 @@ public class PromoteCommand extends SubCommand {
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Promote.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -7,7 +8,6 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -29,7 +29,7 @@ public class PublicCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Public.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Visitor").getStatus())) {
@ -37,16 +37,16 @@ public class PublicCommand extends SubCommand {
islandManager.closeIsland(island);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Public.Private.Message"));
soundManager.playSound(player, Sounds.DOOR_CLOSE.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_WOODEN_DOOR_CLOSE.getSound(), 1.0F, 1.0F);
} else {
island.setOpen(true);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Public.Public.Message"));
soundManager.playSound(player, Sounds.DOOR_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_WOODEN_DOOR_OPEN.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Public.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,15 +1,15 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.*;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -33,7 +33,7 @@ public class SetSpawnCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.SetSpawn.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
IslandEnvironment environment;
@ -43,7 +43,7 @@ public class SetSpawnCommand extends SubCommand {
environment = IslandEnvironment.Visitor;
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.SetSpawn.Spawn.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -59,42 +59,47 @@ public class SetSpawnCommand extends SubCommand {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
if (location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR
|| location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock()
.getType() == Materials.LEGACY_PISTON_MOVING_PIECE.getPostMaterial()) {
CompatibleMaterial toCompare = CompatibleMaterial.getMaterial(location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType());
if(toCompare == CompatibleMaterial.AIR
|| toCompare == CompatibleMaterial.MOVING_PISTON
|| toCompare == CompatibleMaterial.ICE
|| toCompare == CompatibleMaterial.PISTON_HEAD) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Block.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (!player.getLocation().clone().subtract(0, 0.1, 0).getBlock().getType().isSolid()) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Ground.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (location.getBlock().isLiquid()
|| location.clone().add(0.0D, 1.0D, 0.0D).getBlock().isLiquid()) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Liquid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (location.getBlock().getType() == Materials.NETHER_PORTAL.parseMaterial()
|| location.clone().add(0.0D, 1.0D, 0.0D).getBlock()
.getType() == Materials.NETHER_PORTAL.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(location.getBlock().getType()) == CompatibleMaterial.NETHER_PORTAL
|| CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock()
.getType()) == CompatibleMaterial.NETHER_PORTAL) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Portal.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else {
Material type = location.getBlock().getType();
CompatibleMaterial type = CompatibleMaterial.getMaterial(location.getBlock().getType());
if (type.isSolid() && type.isOccluding()) {
location.getBlock().breakNaturally();
}
Material typeBelow = location.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType();
CompatibleMaterial typeBelow = CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType());
if (typeBelow.isSolid() && type.isOccluding()) {
location.clone().add(0.0D, 1.0D, 0.0D).getBlock().breakNaturally();
}
@ -109,7 +114,7 @@ public class SetSpawnCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Set.Message").replace("%spawn",
environment.name().toLowerCase()));
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
return;
}
@ -117,22 +122,22 @@ public class SetSpawnCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Island.Message").replace("%spawn",
environment.name().toLowerCase()));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Permission.Message").replace("%spawn",
environment.name().toLowerCase()));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.SetSpawn.Role.Message")
.replace("%spawn", environment.name().toLowerCase()));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.SetSpawn.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -8,7 +9,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.menus.Settings;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -30,7 +30,7 @@ public class SettingsCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Settings.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
@ -39,15 +39,15 @@ public class SettingsCommand extends SubCommand {
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
Settings.getInstance().open(player,
Settings.Type.Categories, null, null);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Settings.Permission.Default.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Settings.Role.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -10,7 +11,6 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.visit.VisitManager;
import org.bukkit.Bukkit;
@ -50,7 +50,7 @@ public class TeleportCommand extends SubCommand {
if (islandOwnerUUID == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Island.None.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (!islandOwnerUUID.equals(playerDataManager.getPlayerData(player).getOwner())) {
@ -72,25 +72,25 @@ public class TeleportCommand extends SubCommand {
islandManager.visitIsland(player, islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Teleported.Other.Message").replace("%player", targetPlayerName));
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
return;
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Island.Closed.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
return;
}
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Island.None.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
} else if (args.length != 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -99,10 +99,10 @@ public class TeleportCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Teleported.Yourself.Message"));
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.ban.Ban;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
@ -10,7 +11,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -36,7 +36,7 @@ public class UnbanCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unban.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Visitor.Banning")) {
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
@ -58,23 +58,23 @@ public class UnbanCommand extends SubCommand {
if (targetPlayerUUID == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unban.Found.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (targetPlayerUUID.equals(player.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Unban.Yourself.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Member, targetPlayerUUID)
|| island.hasRole(IslandRole.Operator, targetPlayerUUID)
|| island.hasRole(IslandRole.Owner, targetPlayerUUID)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unban.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (!island.getBan().isBanned(targetPlayerUUID)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unban.Banned.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unban.Unbanned.Message")
.replace("%player", targetPlayerName));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
Ban ban = island.getBan();
ban.removeBan(targetPlayerUUID);
@ -82,15 +82,15 @@ public class UnbanCommand extends SubCommand {
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unban.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unban.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unban.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,17 +1,16 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.utils.VaultPermissions;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.apache.commons.lang.WordUtils;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -33,7 +32,7 @@ public class UnlockCommand extends SubCommand {
if (args.length != 1) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -41,13 +40,13 @@ public class UnlockCommand extends SubCommand {
if (!type.equals("Nether") && !type.equals("End")) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.World." + type + ".Enable")) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Disabled.Message").replace("%type%", type));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -56,13 +55,13 @@ public class UnlockCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
if (islandManager.isIslandWorldUnlocked(island, islandWorld)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Unlocked.Message").replace("%type%", type));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -72,11 +71,11 @@ public class UnlockCommand extends SubCommand {
if (!EconomyManager.hasBalance(player, price)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Money.Message").replace(
"%cost%", NumberUtil.formatNumberByDecimal(price)));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
EconomyManager.withdrawBalance(player, price);
islandManager.unlockIslandWorld(island, islandWorld);

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.menus.Upgrade;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -26,16 +26,16 @@ public class UpgradeCommand extends SubCommand {
if (skyblock.getIslandManager().getIsland(player) == null) {
skyblock.getMessageManager().sendMessage(player,
configLoad.getString("Command.Island.Upgrade.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
if (!EconomyManager.isEnabled()) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Upgrade.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
Upgrade.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,7 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -7,9 +9,6 @@ import com.songoda.skyblock.levelling.rework.IslandLevelManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.apache.commons.lang.WordUtils;
import org.bukkit.command.ConsoleCommandSender;
@ -33,15 +32,9 @@ public class ValueCommand extends SubCommand {
if (player.getItemInHand() == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Value.Hand.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
Materials materials = null;
if (NMSUtil.getVersionNumber() < 13) {
materials = Materials.requestMaterials(player.getItemInHand().getType().name(), (byte) player.getItemInHand().getDurability());
} else {
materials = Materials.fromString(player.getItemInHand().getType().name());
}
CompatibleMaterial materials = CompatibleMaterial.getMaterial(player.getItemInHand().getType().name());
if (materials != null && levellingManager.hasWorth(materials)) {
long worth = levellingManager.getWorth(materials);
@ -50,10 +43,10 @@ public class ValueCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Value.Value.Message").replace("%material", WordUtils.capitalizeFully(materials.name().toLowerCase().replace("_", " ")))
.replace("%points", "" + worth).replace("%level", "" + NumberUtil.formatNumberByDecimal(level)));
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Value.None.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.menus.Visit;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
@ -28,14 +28,14 @@ public class VisitCommand extends SubCommand {
playerData.setSort(Visit.Sort.Default);
Visit.getInstance().open(player, (Visit.Type) playerData.getType(), (Visit.Sort) playerData.getSort());
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
} else if (args.length == 1) {
Bukkit.getServer().getScheduler().runTask(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island teleport " + args[0]));
} else {
messageManager.sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Command.Island.Visit.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -7,7 +8,6 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.menus.Visitors;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -29,16 +29,16 @@ public class VisitorsCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Visitors.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (!island.isOpen()) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Visitors.Closed.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (islandManager.getVisitorsAtIsland(island).size() == 0) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Visitors.Visitors.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
Visitors.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -11,7 +12,6 @@ import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.visit.VisitManager;
import org.bukkit.Bukkit;
@ -40,7 +40,7 @@ public class VoteCommand extends SubCommand {
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Visitor.Vote")) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Vote.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
@ -60,10 +60,10 @@ public class VoteCommand extends SubCommand {
if (islandOwnerUUID == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Vote.Island.None.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (!visitManager.hasIsland(islandOwnerUUID)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Vote.Island.Unloaded.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
Visit visit = visitManager.getIsland(islandOwnerUUID);
@ -79,7 +79,7 @@ public class VoteCommand extends SubCommand {
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Vote.Island.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (playerDataManager.hasPlayerData(player)) {
PlayerData playerData = playerDataManager.getPlayerData(player);
@ -90,19 +90,19 @@ public class VoteCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Vote.Vote.Removed.Message")
.replace("%player", targetPlayerName));
soundManager.playSound(player, Sounds.EXPLODE.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_GENERIC_EXPLODE.getSound(), 1.0F, 1.0F);
} else {
visit.addVoter(player.getUniqueId());
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Vote.Vote.Added.Message")
.replace("%player", targetPlayerName));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Vote.Island.Location.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
islandManager.unloadIsland(island, null);
@ -110,12 +110,12 @@ public class VoteCommand extends SubCommand {
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Vote.Island.Closed.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Vote.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
@ -7,7 +8,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.menus.Weather;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -29,15 +29,15 @@ public class WeatherCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Weather.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Weather").getStatus())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
Weather.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Weather.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island.disabled;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -11,7 +12,6 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.skyblock.utils.version.Sounds;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
@ -40,12 +40,12 @@ public class ResetCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Reset.Owner.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (playerData.getConfirmationTime() > 0) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Reset.Confirmation.Pending.Message"));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
} else {
int confirmationTime = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Confirmation.Timeout");
@ -65,11 +65,11 @@ public class ResetCommand extends SubCommand {
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Command.Island.Reset.Confirmation.Confirm.Word.Tutorial")))
.create()))));
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Reset.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island.disabled;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -8,7 +9,6 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.menus.Rollback;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -30,13 +30,13 @@ public class RollbackCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Rollback.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
Rollback.getInstance().open(player);
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Rollback.Role.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}

View File

@ -70,7 +70,9 @@ public class FileManager {
configFiles.put("generators.yml", new File(skyblock.getDataFolder(), "generators.yml"));
configFiles.put("stackables.yml", new File(skyblock.getDataFolder(), "stackables.yml"));
configFiles.put("structures.yml", new File(skyblock.getDataFolder(), "structures.yml"));
configFiles.put("rewards.yml", new File(skyblock.getDataFolder(), "rewards.yml"));
configFiles.put("structures/default.structure", new File(skyblock.getDataFolder().toString() + "/structures", "default.structure"));
configFiles.put("challenges.yml", new File(skyblock.getDataFolder(), "challenges.yml"));
File oldStructureFile = new File(skyblock.getDataFolder().toString() + "/structures", "default.structure");
oldStructureFile.delete();
@ -96,7 +98,7 @@ public class FileManager {
}
if (configFile.exists()) {
if (fileName.equals("config.yml") || fileName.equals("language.yml") || fileName.equals("settings.yml")) {
if (fileName.equals("config.yml") || fileName.equals("language.yml") || fileName.equals("settings.yml") || fileName.equals("worlds.yml")) {
FileChecker fileChecker;
if (fileName.equals("config.yml")) {

View File

@ -2,6 +2,6 @@ package com.songoda.skyblock.confirmation;
public enum Confirmation {
Ownership, Reset, Deletion
Ownership, Reset, Deletion, Preview
}

View File

@ -1,17 +1,18 @@
package com.songoda.skyblock.generator;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
import java.util.List;
public class Generator {
private String name;
private Materials materials;
private CompatibleMaterial materials;
private List<GeneratorMaterial> generatorMaterials;
private boolean permission;
public Generator(String name, Materials materials, List<GeneratorMaterial> generatorMaterials, boolean permission) {
public Generator(String name, CompatibleMaterial materials, List<GeneratorMaterial> generatorMaterials, boolean permission) {
this.name = name;
this.materials = materials;
this.generatorMaterials = generatorMaterials;
@ -22,7 +23,7 @@ public class Generator {
return name;
}
public Materials getMaterials() {
public CompatibleMaterial getMaterials() {
return materials;
}

View File

@ -1,10 +1,11 @@
package com.songoda.skyblock.generator;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
@ -35,8 +36,8 @@ public class GeneratorManager {
if (configLoad.getString("Generators") == null)
return;
Materials[] oreMaterials = new Materials[]{Materials.COAL, Materials.CHARCOAL, Materials.DIAMOND,
Materials.IRON_INGOT, Materials.GOLD_INGOT, Materials.EMERALD};
CompatibleMaterial[] oreMaterials = new CompatibleMaterial[]{CompatibleMaterial.COAL, CompatibleMaterial.CHARCOAL, CompatibleMaterial.DIAMOND,
CompatibleMaterial.IRON_INGOT, CompatibleMaterial.GOLD_INGOT, CompatibleMaterial.EMERALD};
Random rnd = new Random();
for (String generatorList : configLoad.getConfigurationSection("Generators").getKeys(false)) {
@ -46,7 +47,7 @@ public class GeneratorManager {
List<GeneratorMaterial> generatorMaterials = new ArrayList<>();
if (configLoad.getString("Generators." + generatorList + ".Materials") != null) {
for (String materialList : configLoad.getConfigurationSection("Generators." + generatorList + ".Materials").getKeys(false)) {
Materials materials = Materials.fromString(materialList);
CompatibleMaterial materials = CompatibleMaterial.getMaterial(materialList);
if (materials != null) {
generatorMaterials.add(new GeneratorMaterial(materials, configLoad.getDouble(
"Generators." + generatorList + ".Materials." + materialList + ".Chance")));
@ -113,15 +114,16 @@ public class GeneratorManager {
@SuppressWarnings("deprecation")
public BlockState generateBlock(Generator generator, Block block) {
Materials materials = getRandomMaterials(generator);
CompatibleMaterial materials = getRandomMaterials(generator);
if (materials == null) return block.getState();
skyblock.getSoundManager().playSound(block.getLocation(), Sounds.FIZZ.bukkitSound(), 1.0F, 10.0F);
skyblock.getSoundManager().playSound(block.getLocation(), CompatibleSound.BLOCK_FIRE_EXTINGUISH.getSound(), 1.0F, 10.0F);
if (NMSUtil.getVersionNumber() > 12) {
block.setType(materials.parseMaterial());
block.setType(materials.getMaterial());
} else {
ItemStack is = materials.parseItem();
ItemStack is = materials.getItem();
block.setType(is.getType());
try {
@ -134,9 +136,9 @@ public class GeneratorManager {
return block.getState();
}
public Materials getRandomMaterials(Generator generator) {
public CompatibleMaterial getRandomMaterials(Generator generator) {
if (generator.getGeneratorMaterials() != null && generator.getGeneratorMaterials().stream().anyMatch(x -> x.getChance() > 0)) {
List<Materials> weightedList = new ArrayList<>();
List<CompatibleMaterial> weightedList = new ArrayList<>();
for (GeneratorMaterial generatorMaterial : generator.getGeneratorMaterials())
for (int i = 0; i < generatorMaterial.getChance() * 30; i++)
weightedList.add(generatorMaterial.getMaterials());
@ -145,12 +147,12 @@ public class GeneratorManager {
return weightedList.get(choice);
}
return Materials.COBBLESTONE;
return CompatibleMaterial.COBBLESTONE;
}
public void addGenerator(String name, List<GeneratorMaterial> generatorMaterials, boolean permission) {
Materials[] oreMaterials = new Materials[]{Materials.COAL, Materials.CHARCOAL, Materials.DIAMOND,
Materials.IRON_INGOT, Materials.GOLD_INGOT, Materials.EMERALD};
CompatibleMaterial[] oreMaterials = new CompatibleMaterial[]{CompatibleMaterial.COAL, CompatibleMaterial.CHARCOAL, CompatibleMaterial.DIAMOND,
CompatibleMaterial.IRON_INGOT, CompatibleMaterial.GOLD_INGOT, CompatibleMaterial.EMERALD};
generatorStorage.add(new Generator(name, oreMaterials[new Random().nextInt(oreMaterials.length)],
generatorMaterials, permission));
}

View File

@ -1,18 +1,18 @@
package com.songoda.skyblock.generator;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
public class GeneratorMaterial {
private Materials materials;
private CompatibleMaterial materials;
private double chance;
public GeneratorMaterial(Materials materials, double chance) {
public GeneratorMaterial(CompatibleMaterial materials, double chance) {
this.materials = materials;
this.chance = chance;
}
public Materials getMaterials() {
public CompatibleMaterial getMaterials() {
return materials;
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.invite;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.skyblock.utils.version.Sounds;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
@ -68,13 +68,13 @@ public class InviteTask extends BukkitRunnable {
configLoad.getString(
"Command.Island.Invite.Invited.Word.Resend"))))
.create()))));
soundManager.playSound(targetPlayer, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
messageManager.sendMessage(all,
configLoad.getString("Command.Island.Invite.Invited.Target.Expired.Message")
.replace("%player", invite.getSenderName()));
soundManager.playSound(all, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(all, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
inviteManager.removeInvite(all.getUniqueId());
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.*;
import com.songoda.skyblock.api.utils.APIUtil;
@ -11,9 +12,9 @@ import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.WorldBorder;
import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.world.WorldManager;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -350,6 +351,25 @@ public class Island {
.getFileConfiguration().set("Border.Color", color.name());
}
public boolean isInBorder(Location blockLocation) {
WorldManager worldManager = skyblock.getWorldManager();
if(!isBorder()) {
return true;
}
Location islandLocation = getLocation(worldManager.getIslandWorld(blockLocation.getWorld()), IslandEnvironment.Island);
double halfSize = Math.floor(getRadius());
if(blockLocation.getBlockX() > (islandLocation.getBlockX()+halfSize)
|| blockLocation.getBlockX() < (islandLocation.getBlockX()-halfSize-1)
|| blockLocation.getBlockZ() > (islandLocation.getBlockZ()+halfSize)
|| blockLocation.getBlockZ() < (islandLocation.getBlockZ()-halfSize-1)) {
return false;
}
return true;
}
public Biome getBiome() {
return Biome.valueOf(skyblock.getFileManager().getConfig(
new File(new File(skyblock.getDataFolder().toString() + "/island-data"), ownerUUID.toString() + ".yml"))
@ -827,7 +847,7 @@ public class Island {
.getString("Island.Unlock." + type + ".Message").replace(
"%cost%", NumberUtil.formatNumberByDecimal(price)));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
player.setVelocity(player.getLocation().getDirection().multiply(-.50));
}
return unlocked;

View File

@ -1,18 +1,19 @@
package com.songoda.skyblock.island;
import com.google.common.base.Strings;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.reward.LevelReward;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
public class IslandLevel {
@ -25,6 +26,9 @@ public class IslandLevel {
private Map<String, Long> materials;
// Highest level achieved, to prevent reward farming (since is level can decrease)
private long highestLevel;
public IslandLevel(UUID ownerUUID, SkyBlock skyblock) {
this.skyblock = skyblock;
this.ownerUUID = ownerUUID;
@ -44,14 +48,14 @@ public class IslandLevel {
ConfigurationSection current = section.getConfigurationSection(material);
if (current.isSet("Amount")) materials.put(material, current.getLong("Amount"));
}
} else {
materials = new HashMap<>();
}
this.materials = materials;
this.highestLevel = configLoad.contains("Levelling.Highest-Level") ? configLoad.getLong("Levelling.Highest-Level") : getLevel();
}
public void setOwnerUUID(UUID ownerUUID) {
@ -113,6 +117,54 @@ public class IslandLevel {
return getPoints() / division;
}
public void checkLevelUp() {
long level = getLevel();
// Level didn't reach the highest
if (level <= highestLevel)
return;
final FileConfiguration language = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration();
final FileConfiguration config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration();
OfflinePlayer owner = Bukkit.getOfflinePlayer(ownerUUID);
if (owner.isOnline()) {
Player player = owner.getPlayer();
if (config.getBoolean("Island.LevelRewards.Rewards", false)) {
// Reward the player for each level reached, message only for the highest, so we don't spam the chat
for (int i = (int) highestLevel + 1; i <= level; i++) {
LevelReward levelReward = skyblock.getRewardManager().getReward(i);
if (levelReward != null)
levelReward.give(player, skyblock, i);
List<LevelReward> repeatRewards = skyblock.getRewardManager().getRepeatRewards(i);
if (!repeatRewards.isEmpty()) {
for (LevelReward reward : repeatRewards) {
reward.give(player, skyblock, i);
}
}
}
}
if (config.getBoolean("Island.LevelRewards.Messages", false)) {
String msg = language.getString("Command.Island.Level.LevelUp.Message");
if (!Strings.isNullOrEmpty(msg)) {
msg = msg.replace("%level%", String.valueOf(level));
skyblock.getMessageManager().sendMessage(player, msg);
}
}
}
setHighestLevel(level);
}
public void setMaterialAmount(String material, long amount) {
skyblock.getFileManager().getConfig(new File(new File(skyblock.getDataFolder().toString() + "/level-data"), ownerUUID.toString() + ".yml")).getFileConfiguration()
.set("Levelling.Materials." + material + ".Amount", amount);
@ -183,4 +235,13 @@ public class IslandLevel {
e.printStackTrace();
}
}
public void setHighestLevel(long highestLevel) {
Config config = skyblock.getFileManager().getConfig(new File(new File(skyblock.getDataFolder().toString() + "/level-data"), ownerUUID.toString() + ".yml"));
FileConfiguration configLoad = config.getFileConfiguration();
configLoad.set("Levelling.Highest-Level", highestLevel);
this.highestLevel = highestLevel;
}
}

View File

@ -1,6 +1,8 @@
package com.songoda.skyblock.island;
import com.google.common.base.Preconditions;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.*;
import com.songoda.skyblock.ban.BanManager;
@ -21,23 +23,18 @@ import com.songoda.skyblock.structure.Structure;
import com.songoda.skyblock.structure.StructureManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.upgrade.UpgradeManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.player.PlayerUtil;
import com.songoda.skyblock.utils.structure.SchematicUtil;
import com.songoda.skyblock.utils.structure.StructureUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.SBiome;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.utils.world.WorldBorder;
import com.songoda.skyblock.utils.world.block.BlockDegreesType;
import com.songoda.skyblock.visit.VisitManager;
import com.songoda.skyblock.world.WorldManager;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import org.bukkit.*;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
@ -46,16 +43,27 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.IllegalPluginAccessException;
import com.songoda.skyblock.confirmation.Confirmation;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
public class IslandManager {
private final SkyBlock skyblock;
private double x = 0, offset = 1200;
private List<IslandPosition> islandPositions = new ArrayList<>();
private Map<UUID, UUID> islandProxies = new HashMap<>();
private Map<UUID, Island> islandStorage = new HashMap<>();
private int offset = 1200;
private HashMap<IslandWorld, Integer> oldSystemIslands;
public IslandManager(SkyBlock skyblock) {
this.skyblock = skyblock;
@ -74,6 +82,8 @@ public class IslandManager {
for (Island island : getIslands().values()) {
if (island.isAlwaysLoaded()) loadIslandAtLocation(island.getLocation(IslandWorld.Normal, IslandEnvironment.Island));
}
loadIslandPositions();
}
public void onDisable() {
@ -90,15 +100,15 @@ public class IslandManager {
File configFile = config.getFile();
FileConfiguration configLoad = config.getFileConfiguration();
for (IslandPosition islandPositionList : islandPositions) {
if (islandPositionList.getWorld() == world) {
int island_number = (int) configLoad.get("World." + world.name() + ".nextAvailableLocation.island_number");
ConfigurationSection configSection = configLoad.createSection("World." + world.name() + ".nextAvailableLocation");
configSection.set("x", islandPositionList.getX());
configSection.set("z", islandPositionList.getZ());
configSection.set("island_number", (island_number + 1));
}
}
try {
configLoad.save(configFile);
} catch (IOException e) {
@ -115,24 +125,64 @@ public class IslandManager {
}
}
public org.bukkit.Location prepareNextAvailableLocation(IslandWorld world) {
for (IslandPosition islandPositionList : islandPositions) {
if (islandPositionList.getWorld() == world) {
double x = islandPositionList.getX() + offset, z = islandPositionList.getZ();
if (x > Math.abs(this.x)) {
z += offset;
islandPositionList.setX(this.x);
x = islandPositionList.getX() + offset;
islandPositionList.setZ(z);
Config config_world = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "worlds.yml"));
Config config_config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad_world = config_world.getFileConfiguration();
FileConfiguration configLoad_config = config_config.getFileConfiguration();
int x = (int) configLoad_world.get("World." + world.name() + ".nextAvailableLocation.island_number");
int islandHeight = configLoad_config.getInt("Island.World." + world.name() + ".IslandSpawnHeight", 72);
while (true) {
double r = Math.floor((Math.sqrt(x + 1) - 1) / 2) + 1;
double p = (8 * r * (r -1)) / 2;
double en = r * 2;
double a = (x - p) % (r * 8);
int posX = 0;
int posY = 0;
int loc = (int) Math.floor(a / (r * 2));
switch (loc) {
case 0 :
posX = (int) (a-r);
posY = (int) (-r);
break;
case 1:
posX = (int) r;
posY = (int) ((a % en) - r);
break;
case 2:
posX = (int) (r - (a % en));
posY = (int) r;
break;
case 3:
posX = (int) (-r);
posY = (int) (r - (a % en));
break;
default:
System.err.println("[FabledSkyblock][prepareNextAvailableLocation] Erreur dans la spirale, valeur : " + loc);
return null;
}
posX = posX * offset;
posY = posY * offset;
islandPositionList.setX((double) posX);
islandPositionList.setZ((double) posY);
// Check if there was an island at this position
int oldFormatPos = oldSystemIslands.get(world);
Location islandLocation = new org.bukkit.Location(skyblock.getWorldManager().getWorld(world), islandPositionList.getX(), islandHeight, islandPositionList.getZ());
if (posX == 1200 && posY >= 0 && posY <= oldFormatPos) {
// We have to save to avoid having two islands at same location
setNextAvailableLocation(world, islandLocation);
saveNextAvailableLocation(world);
x++;
continue;
}
return islandLocation;
}
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
int islandHeight = configLoad.getInt("Island.World." + world.name() + ".IslandSpawnHeight", 72);
return new org.bukkit.Location(skyblock.getWorldManager().getWorld(world), x, islandHeight, z);
}
}
@ -156,12 +206,11 @@ public class IslandManager {
skyblock.getMessageManager().sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Creator.Error.MaxCreationMessage"));
return false;
}
}
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")).getFileConfiguration().getString("Location.Spawn") == null) {
skyblock.getMessageManager().sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Creator.Error.Message"));
skyblock.getSoundManager().playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
skyblock.getSoundManager().playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return false;
}
@ -257,6 +306,118 @@ public class IslandManager {
return true;
}
public boolean previewIsland(Player player, Structure structure) {
FileManager fileManager = skyblock.getFileManager();
PlayerData data = skyblock.getPlayerDataManager().getPlayerData(player);
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
FileConfiguration configLang = config.getFileConfiguration();
config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configMain = config.getFileConfiguration();
if (data != null) {
final int highest = PlayerUtil.getNumberFromPermission(player, "fabledskyblock.limit.create", true, 2);
if ((data.getIslandCreationCount()) >= highest) {
skyblock.getMessageManager().sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Creator.Error.MaxCreationMessage"));
return false;
}
}
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")).getFileConfiguration().getString("Location.Spawn") == null) {
skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Creator.Error.Message"));
skyblock.getSoundManager().playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return false;
}
Island island = new Island(player);
island.setStructure(structure.getName());
islandStorage.put(player.getUniqueId(), island);
data.setPreview(true);
for (IslandWorld worldList : IslandWorld.getIslandWorlds())
prepareIsland(island, worldList);
Bukkit.getScheduler().callSyncMethod(SkyBlock.getInstance(), () -> {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Island));
player.setGameMode(GameMode.SPECTATOR);
return true;
});
Bukkit.getScheduler().runTaskLater(skyblock, () -> {
if(data.isPreview()) {
Location spawn = fileManager.getLocation(fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")), "Location.Spawn", true);
player.teleport(spawn);
player.setGameMode(GameMode.SURVIVAL);
data.setIsland(null);
islandStorage.remove(player.getUniqueId(), island);
deleteIsland(island, true);
skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Preview.Timeout.Message"));
data.setPreview(false);
}
}, configMain.getInt("Island.Preview.Time")*20);
String defaultMessage = configLang.getString("Command.Island.Preview.Confirmation.Message")
.replaceAll("%time", "" + configMain.get("Island.Preview.Time"));
defaultMessage = defaultMessage.replace("\\n", "\n");
for (String message : defaultMessage.split("\n")) {
ChatComponent confirmation = null, cancelation = null;
if(message.contains("%confirm")) {
message = message.replace("%confirm", "");
confirmation = new ChatComponent(configLang.getString("Command.Island.Preview.Confirmation.Word.Confirm").toUpperCase() + " ",
true, net.md_5.bungee.api.ChatColor.GREEN,
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/island preview confirm"),
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder(
net.md_5.bungee.api.ChatColor.translateAlternateColorCodes(
'&',
configLang.getString("Command.Island.Preview.Confirmation.Word.TutorialConfirm")))
.create()
));
}
if(message.contains("%cancel")) {
message = message.replace("%cancel", "");
cancelation = new ChatComponent(configLang.getString("Command.Island.Preview.Confirmation.Word.Cancel").toUpperCase(),
true, net.md_5.bungee.api.ChatColor.GREEN,
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/island preview cancel"),
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder(
net.md_5.bungee.api.ChatColor.translateAlternateColorCodes(
'&',
configLang.getString("Command.Island.Preview.Confirmation.Word.TutorialCancel")))
.create()
));
}
TextComponent confirmationMessage = new TextComponent(net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', message));
if(confirmation != null) {
confirmationMessage.addExtra(confirmation.getTextComponent());
}
if(cancelation != null) {
confirmationMessage.addExtra(cancelation.getTextComponent());
}
player.spigot().sendMessage(confirmationMessage);
}
data.setConfirmation(Confirmation.Preview);
data.setConfirmationTime(configMain.getInt("Island.Preview.Time"));
return true;
}
public void giveOwnership(Island island, org.bukkit.OfflinePlayer player) {
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
CooldownManager cooldownManager = skyblock.getCooldownManager();
@ -554,6 +715,54 @@ public class IslandManager {
return null;
}
/**
* The old island position system was not good, it always create islands at x = 1200 and z starting at 0 and increasing by 1200<br />
* This method will get the nextAvailableLocation for normal, nether and end islands in worlds.yml file
* to avoid creating island where an existing island was
*/
public void loadIslandPositions() {
oldSystemIslands = new HashMap<>();
FileManager fileManager = skyblock.getFileManager();
Config config = fileManager.getConfig(new File(skyblock.getDataFolder().toString() + "/worlds.yml"));
FileConfiguration fileConfig = config.getFileConfiguration();
Config config2 = fileManager.getConfig(new File(skyblock.getDataFolder().toString() + "/worlds.oldformat.yml"));
FileConfiguration fileConfig2 = config2.getFileConfiguration();
// TODO Find a way to automatically
int normalZ = 0;
int netherZ = 0;
int endZ = 0;
if (!config2.getFile().exists()) {
// Old data
Bukkit.getLogger().info("[FabledSkyblock] Old format detected, please wait ...");
if (fileConfig.contains("World.Normal.nextAvailableLocation"))
normalZ = fileConfig.getInt("World.Normal.nextAvailableLocation.z");
if (fileConfig.contains("World.Nether.nextAvailableLocation"))
netherZ = fileConfig.getInt("World.Nether.nextAvailableLocation.z");
if (fileConfig.contains("World.End.nextAvailableLocation"))
endZ = fileConfig.getInt("World.End.nextAvailableLocation.z");
// Save
fileConfig2.set("Normal", normalZ);
fileConfig2.set("Nether", netherZ);
fileConfig2.set("End", endZ);
try {
fileConfig2.save(config2.getFile());
} catch (IOException ex) {
ex.printStackTrace();
}
Bukkit.getLogger().info("[FabledSkyblock] Done ! Got normalZ = " + normalZ + ", netherZ = " + netherZ + ", endZ = " + endZ);
} else {
// Load datas
normalZ = fileConfig2.getInt("Normal");
netherZ = fileConfig2.getInt("Nether");
endZ = fileConfig2.getInt("End");
}
oldSystemIslands.put(IslandWorld.Normal, normalZ);
oldSystemIslands.put(IslandWorld.Nether, netherZ);
oldSystemIslands.put(IslandWorld.End, endZ);
}
public Island loadIslandAtLocation(Location location) {
FileManager fileManager = skyblock.getFileManager();
File configFile = new File(skyblock.getDataFolder().toString() + "/island-data");
@ -1023,13 +1232,13 @@ public class IslandManager {
public void removeSpawnProtection(org.bukkit.Location location) {
Block block = location.getBlock();
if (block.getType() == Materials.MOVING_PISTON.parseMaterial()) {
if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.MOVING_PISTON) {
block.setType(Material.AIR);
}
block = location.clone().add(0.0D, 1.0D, 0.0D).getBlock();
if (block.getType() == Materials.MOVING_PISTON.parseMaterial()) {
if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.MOVING_PISTON) {
block.setType(Material.AIR);
}
}
@ -1223,7 +1432,7 @@ public class IslandManager {
messageManager.sendMessage(targetPlayer, configLoad.getString("Island.Coop.Removed.Owner.Message"));
}
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import java.util.Queue;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Material;
import org.bukkit.World;
@ -44,7 +45,7 @@ public class ChunkDeleteSplitter extends BukkitRunnable {
final BlockInfo pair = it.next();
final Block block = pair.getWorld().getBlockAt(pair.getX(), pair.getY(), pair.getZ());
block.setType(Material.AIR);
block.setType(CompatibleMaterial.AIR.getBlockMaterial());
deleteAmount++;
it.remove();

View File

@ -0,0 +1,54 @@
package com.songoda.skyblock.island.reward;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class LevelReward {
private List<String> commands = new ArrayList<>();
private double money = 0;
private double islandBalance = 0;
public LevelReward() {
}
public void give(Player player, SkyBlock skyblock, long level) {
if (islandBalance > 0) {
Island island = skyblock.getIslandManager().getIsland(player);
island.addToBank(islandBalance);
}
if (money > 0)
EconomyManager.deposit(player, money);
if (!commands.isEmpty()) {
for (String cmd : commands) {
cmd = cmd.replace("%level%", String.valueOf(level))
.replace("%player%", player.getName())
.trim();
skyblock.getServer().dispatchCommand(skyblock.getConsole(), cmd);
}
}
}
public void setCommands(List<String> commands) {
this.commands = commands;
}
public void setMoney(double money) {
this.money = money;
}
public void setIslandBalance(double islandBalance) {
this.islandBalance = islandBalance;
}
}

Some files were not shown because too many files have changed in this diff Show More