Merge branch 'development'

This commit is contained in:
Brianna 2020-04-01 10:54:26 -04:00
commit 63f25f1dd3
7 changed files with 54 additions and 42 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId>
<version>2.2</version>
<version>2.2.1</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>FabledSkyblock-${project.version}</finalName>

View File

@ -54,8 +54,10 @@ public class ChallengeCategory {
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();
CompatibleMaterial compatibleMaterial = CompatibleMaterial.getMaterial(strItem);
if (compatibleMaterial == null)
throw new IllegalArgumentException("Item " + strItem + " isn't a correct material");
Material item = compatibleMaterial.getMaterial();
if (item == null)
throw new IllegalArgumentException("Item " + strItem + " isn't a correct material");
ItemChallenge ic = new ItemChallenge(show, row, col, item, amount, lore);

View File

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.function.Consumer;
import java.util.logging.Level;
import com.songoda.core.compatibility.CompatibleSound;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
@ -90,7 +91,7 @@ public class ChallengeInventory implements InventoryProvider {
// Update count
count2 = done.getOrDefault(c, 0);
// Play sound
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
p.playSound(p.getLocation(), CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 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

View File

@ -134,14 +134,14 @@ public class Island {
Config settingsDataConfig = null;
File settingDataFile = new File(skyblock.getDataFolder().toString() + "/setting-data", getOwnerUUID().toString() + ".yml");
if (fileManager.isFileExist(settingDataFile)) {
settingsDataConfig = fileManager.getConfig(settingDataFile);
}
for (IslandRole roleList : IslandRole.getRoles()) {
List<IslandSetting> settings = new ArrayList<>();
for (String settingList : defaultSettingsConfig.getFileConfiguration().getConfigurationSection("Settings." + roleList.name()).getKeys(false)) {
if (settingsDataConfig == null || settingsDataConfig.getFileConfiguration().getString("Settings." + roleList.name() + "." + settingList) == null) {
settings.add(
@ -353,17 +353,17 @@ public class Island {
public boolean isInBorder(Location blockLocation) {
WorldManager worldManager = skyblock.getWorldManager();
if(!isBorder()) {
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)) {
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;
}
@ -413,10 +413,14 @@ public class Island {
WeatherType weatherType;
if (weatherTypeName == null || weatherTypeName.isEmpty() || WeatherType.valueOf(weatherTypeName) == null) {
if (weatherTypeName == null || weatherTypeName.isEmpty()) {
weatherType = WeatherType.CLEAR;
} else {
weatherType = WeatherType.valueOf(weatherTypeName);
try {
weatherType = WeatherType.valueOf(weatherTypeName);
} catch (IllegalArgumentException e) {
weatherType = WeatherType.CLEAR;
}
}
return weatherType;
@ -615,10 +619,10 @@ public class Island {
}
public boolean hasUpgrade(Upgrade.Type type) {
return skyblock.getFileManager().getConfig(
new File(new File(skyblock.getDataFolder().toString() + "/island-data"), ownerUUID.toString() + ".yml"))
.getFileConfiguration().getString("Upgrade." + type.name()) != null;
}
return skyblock.getFileManager().getConfig(
new File(new File(skyblock.getDataFolder().toString() + "/island-data"), ownerUUID.toString() + ".yml"))
.getFileConfiguration().getString("Upgrade." + type.name()) != null;
}
public boolean isUpgrade(Upgrade.Type type) {
return skyblock.getFileManager().getConfig(
@ -735,8 +739,8 @@ public class Island {
}
public boolean hasStructure() {
return getStructure() != null;
}
return getStructure() != null;
}
public String getStructure() {
return skyblock.getFileManager().getConfig(
@ -775,13 +779,13 @@ public class Island {
Config config = fileManager
.getConfig(new File(skyblock.getDataFolder().toString() + "/island-data", ownerUUID.toString() + ".yml"));
try {
config.getFileConfiguration().save(config.getFile());
} catch (IOException e) {
e.printStackTrace();
}
config = fileManager
.getConfig(new File(skyblock.getDataFolder().toString() + "/setting-data", ownerUUID.toString() + ".yml"));
FileConfiguration configLoad = config.getFileConfiguration();

View File

@ -74,7 +74,7 @@ public class Teleport implements Listener {
event.setCancelled(true);
messageManager.sendMessage(player, configLoad.getString("Island.Settings.Permission.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
return;
}
@ -176,20 +176,22 @@ public class Teleport implements Listener {
}
}
}
@EventHandler
public void onEntityTeleport(EntityPortalEvent e) {
WorldManager worldManager = skyblock.getWorldManager();
// Do not handle player
if (e.getEntityType() == EntityType.PLAYER)
return;
Location from = e.getFrom();
Location to = e.getTo();
// Test which world the event is from
if (from.getWorld() == to.getWorld())
return;
if (worldManager.getIslandWorld(e.getFrom().getWorld()) != null)
e.setCancelled(true);
}
@EventHandler
public void onEntityTeleport(EntityPortalEvent e) {
WorldManager worldManager = skyblock.getWorldManager();
// Do not handle player
if (e.getEntityType() == EntityType.PLAYER)
return;
Location from = e.getFrom();
Location to = e.getTo();
if (to == null || from.getWorld() == to.getWorld())
return;
if (worldManager.getIslandWorld(e.getFrom().getWorld()) != null)
e.setCancelled(true);
}
}

View File

@ -190,6 +190,9 @@ public class Levelling {
long value = testIslandMaterials.get(materialName);
CompatibleMaterial materials = CompatibleMaterial.getMaterial(materialName);
if (materials == null) continue;
ItemStack is = materials.getItem();
if (is == null || is.getItemMeta() == null) continue;

View File

@ -388,7 +388,7 @@ challenges:
id: 3
name: '&2A Prickly Affair'
require:
- 'ITEM:cactus_green 48'
- 'ITEM:green_dye 48'
reward:
- 'CMD:eco give {player} 200'
- 'ITEM:sand 24'
@ -398,7 +398,7 @@ challenges:
show: true
row: 1
col: 5
item: cactus_green
item: green_dye
amount: 1
lore:
- '&c&lFor this challenge, you''ll need:'
@ -1368,8 +1368,8 @@ challenges:
id: 2
name: '&2Artist'
require:
- 'ITEM:rose_red 64'
- 'ITEM:cactus_green 64'
- 'ITEM:red_dye 64'
- 'ITEM:green_dye 64'
- 'ITEM:purple_dye 64'
- 'ITEM:cyan_dye 64'
- 'ITEM:light_gray_dye 64'
@ -1393,7 +1393,7 @@ challenges:
show: true
row: 1
col: 4
item: dandelion_yellow
item: YELLOW_DYE
amount: 1
lore:
- '&c&lFor this challenge, you''ll need:'