diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 42c9532..f9a8f94 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -5,7 +5,22 @@ themepark 3.1.0 + clean package + + + true + src/main/resources + + + ThemePark v${project.version} + + maven-compiler-plugin + 3.8.1 + + 11 + + maven-shade-plugin 3.2.0 diff --git a/pom.xml b/pom.xml index 7121122..c6e7269 100644 --- a/pom.xml +++ b/pom.xml @@ -113,7 +113,23 @@ + clean package + ThemePark v${project.version} + + + src/main/resources + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + + org.apache.maven.plugins maven-shade-plugin diff --git a/src/main/java/nl/iobyte/themepark/api/menu/objects/MainMenu.java b/src/main/java/nl/iobyte/themepark/api/menu/objects/MainMenu.java index bc5eab6..0aec19f 100644 --- a/src/main/java/nl/iobyte/themepark/api/menu/objects/MainMenu.java +++ b/src/main/java/nl/iobyte/themepark/api/menu/objects/MainMenu.java @@ -1,5 +1,6 @@ package nl.iobyte.themepark.api.menu.objects; +import com.cryptomorin.xseries.XMaterial; import nl.iobyte.menuapi.MenuAPI; import nl.iobyte.menuapi.action.HandlerAction; import nl.iobyte.menuapi.basic.Menu; @@ -59,10 +60,14 @@ public class MainMenu { if(name == null || name.equals("")) name = " "; - Material material = Material.getMaterial(manager.getString(StorageLocation.MENU, path+".material")); + XMaterial material = XMaterial.matchXMaterial(manager.getString(StorageLocation.MENU, path+".material")).orElse(null); if(material == null) continue; + Material m = material.parseMaterial(); + if(m == null) + continue; + int amount = manager.getInt(StorageLocation.MENU, path+".amount"); if(amount < 1) amount = 1; @@ -71,7 +76,7 @@ public class MainMenu { if(data < 0) continue; - builder = new ItemBuilder(material, amount, data); + builder = new ItemBuilder(m, amount, data); builder.setName(name); String lore = manager.getString(StorageLocation.MENU, path+".lore"); diff --git a/src/main/java/nl/iobyte/themepark/api/menu/objects/actions/TPAction.java b/src/main/java/nl/iobyte/themepark/api/menu/objects/actions/TPAction.java index b1f535e..8eba02a 100644 --- a/src/main/java/nl/iobyte/themepark/api/menu/objects/actions/TPAction.java +++ b/src/main/java/nl/iobyte/themepark/api/menu/objects/actions/TPAction.java @@ -1,7 +1,9 @@ package nl.iobyte.themepark.api.menu.objects.actions; import nl.iobyte.menuapi.action.MenuAction; +import nl.iobyte.themepark.ThemePark; import nl.iobyte.themepark.api.attraction.objects.Attraction; +import nl.iobyte.themepark.api.config.enums.StorageKey; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -14,7 +16,7 @@ public class TPAction extends MenuAction { } public void execute(Player player) { - Bukkit.dispatchCommand(player, "themepark attraction warp "+attraction.getID()); + Bukkit.dispatchCommand(player, ThemePark.getInstance().getAPI().getConfigurationManager().getString(StorageKey.CMD)+" attraction warp "+attraction.getID()); } } diff --git a/src/main/java/nl/iobyte/themepark/api/sign/SignManager.java b/src/main/java/nl/iobyte/themepark/api/sign/SignManager.java index b698d37..2e35163 100644 --- a/src/main/java/nl/iobyte/themepark/api/sign/SignManager.java +++ b/src/main/java/nl/iobyte/themepark/api/sign/SignManager.java @@ -19,21 +19,22 @@ public class SignManager { return signs; } - public void addSign(StatusSign sign) { + public boolean addSign(StatusSign sign) { if(sign == null || sign.getLocation() == null) - return; + return false; if(!(sign.getLocation().getBlock().getState() instanceof Sign)) - return; + return false; if(signs.containsKey(sign.getAttraction())) { signs.get(sign.getAttraction()).add(sign); - return; + return true; } ArrayList array = new ArrayList<>(); array.add(sign); signs.put(sign.getAttraction(), array); + return true; } public boolean hasSigns(Attraction attraction) { @@ -84,36 +85,40 @@ public class SignManager { ThemePark.getInstance().getAPI().getConfigurationManager().set(StorageLocation.SIGN_DATA, "signs."+attraction.getID(), null); } - public void removeSign(StatusSign sign) { + public boolean removeSign(StatusSign sign) { if(sign == null || sign.getLocation() == null || sign.getAttraction() == null) - return; + return false; if(!hasSigns(sign.getAttraction())) - return; + return false; + String str2; Location loc1 = sign.getLocation(); String str1 = LocationUtil.toString(loc1); ArrayList array = signs.get(sign.getAttraction()); + boolean b = false; for(StatusSign s : new ArrayList<>(array)) { Location loc2 = s.getLocation(); if(loc1 == null || loc2 == null) - return; - - String str2 = LocationUtil.toString(loc2); + continue; + str2 = LocationUtil.toString(loc2); if(!str1.equals(str2)) - return; + continue; array.remove(s); + b = true; + break; } if(array.isEmpty()) { signs.remove(sign.getAttraction()); ThemePark.getInstance().getAPI().getConfigurationManager().set(StorageLocation.SIGN_DATA, "signs."+sign.getAttraction().getID(), null); - return; + return b; } signs.put(sign.getAttraction(), array); + return b; } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/ItemCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/ItemCommand.java index 24523bd..913b431 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/ItemCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/ItemCommand.java @@ -35,7 +35,7 @@ public class ItemCommand extends SubCommand { Player player = (Player) sender.getOriginal(); player.getInventory().addItem(builder.getItem()); player.updateInventory(); - player.sendMessage(Text.color("&6&lThemeParkMC &f➢ Added item to your inventory")); + player.sendMessage(Text.color("&6&lThemePark &f➢ Added item to your inventory")); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionCoverCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionCoverCommand.java index a5544f8..470301c 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionCoverCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionCoverCommand.java @@ -22,6 +22,6 @@ public class AttractionCoverCommand extends SubCommand { Attraction attraction = (Attraction) list.get(0); String url = (String) list.get(1); attraction.setCover(url); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed the cover of attraction &f"+attraction.getID())); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed the cover of attraction &f"+attraction.getID())); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionCreateCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionCreateCommand.java index 45b78c7..cf4afcc 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionCreateCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionCreateCommand.java @@ -64,7 +64,7 @@ public class AttractionCreateCommand extends SubCommand { status, location )); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully created attraction &f"+id)); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully created attraction &f"+id)); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionListCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionListCommand.java index 4306490..b62c2ba 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionListCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionListCommand.java @@ -75,7 +75,7 @@ public class AttractionListCommand extends SubCommand { private void sendMultiPage(ICommandExecutor sender, int page, String title, Collection attractions) { int pages = (int) Math.ceil(((double) attractions.size()) / 5); if(page < 1 || page > pages) { - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ Page &6"+page+" &fdoesn't exist")); + sender.sendMessage(Text.color("&6&lThemePark &f➢ Page &6"+page+" &fdoesn't exist")); return; } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionLocationCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionLocationCommand.java index ec148d7..c080660 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionLocationCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionLocationCommand.java @@ -22,7 +22,7 @@ public class AttractionLocationCommand extends SubCommand { Attraction attraction = (Attraction) list.get(0); Player player = (Player) sender.getOriginal(); attraction.setLocation(player.getLocation()); - player.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed the location of attraction &f"+attraction.getID())); + player.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed the location of attraction &f"+attraction.getID())); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionNameCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionNameCommand.java index 0bb7bae..384cb72 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionNameCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionNameCommand.java @@ -22,7 +22,7 @@ public class AttractionNameCommand extends SubCommand { Attraction attraction = (Attraction) list.get(0); String name = (String) list.get(1); attraction.setName(name); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed the name of attraction &f"+attraction.getID())); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed the name of attraction &f"+attraction.getID())); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionRegionCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionRegionCommand.java index daa78db..7b70d07 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionRegionCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionRegionCommand.java @@ -23,7 +23,7 @@ public class AttractionRegionCommand extends SubCommand { Attraction attraction = (Attraction) list.get(0); Region region = (Region) list.get(1); attraction.setRegionID(region.getID()); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed the region of attraction &f"+attraction.getID())); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed the region of attraction &f"+attraction.getID())); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionRemoveCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionRemoveCommand.java index 23221e3..ac2be97 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionRemoveCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionRemoveCommand.java @@ -20,7 +20,7 @@ public class AttractionRemoveCommand extends SubCommand { public void onCommand(ICommandExecutor sender, List list, int i) { Attraction attraction = (Attraction) list.get(0); ThemePark.getInstance().getAPI().getAttractionService().removeAttraction(attraction.getID()); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully removed attraction &f"+attraction.getID())); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully removed attraction &f"+attraction.getID())); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionStatusCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionStatusCommand.java index 6efbc94..491e2b9 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionStatusCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionStatusCommand.java @@ -37,7 +37,7 @@ public class AttractionStatusCommand extends SubCommand { return; attraction.setStatus(status); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed the status of attraction &f"+attraction.getID())); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed the status of attraction &f"+attraction.getID())); } ); } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionWarpCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionWarpCommand.java index d9597c5..1cf1dfd 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionWarpCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/attraction/AttractionWarpCommand.java @@ -32,7 +32,7 @@ public class AttractionWarpCommand extends SubCommand { } if(attraction.getLocation() == null) { - player.sendMessage(Text.color("&6&lThemeParkMC &f➢ &4No location available for this attraction")); + player.sendMessage(Text.color("&6&lThemePark &f➢ &4No location available for this attraction")); return; } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionCreateCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionCreateCommand.java index bddff00..5e9db6e 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionCreateCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionCreateCommand.java @@ -28,7 +28,7 @@ public class RegionCreateCommand extends SubCommand { id, name )); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully created region &f"+id)); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully created region &f"+id)); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionListCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionListCommand.java index 48a71e5..dfbb94e 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionListCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionListCommand.java @@ -49,7 +49,7 @@ public class RegionListCommand extends SubCommand { page = (Integer) list.get(0); if(page < 1 || page > pages) { - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ Page &6"+page+" &fdoesn't exist")); + sender.sendMessage(Text.color("&6&lThemePark &f➢ Page &6"+page+" &fdoesn't exist")); return; } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionNameCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionNameCommand.java index f5270ef..8e3e6e5 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionNameCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionNameCommand.java @@ -22,7 +22,7 @@ public class RegionNameCommand extends SubCommand { Region region = (Region) list.get(0); String name = (String) list.get(1); region.setName(name); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed the name of region &f"+region.getID())); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed the name of region &f"+region.getID())); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionRemoveCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionRemoveCommand.java index a7b7f58..e837335 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionRemoveCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/region/RegionRemoveCommand.java @@ -20,7 +20,7 @@ public class RegionRemoveCommand extends SubCommand { public void onCommand(ICommandExecutor sender, List list, int i) { Region region = (Region) list.get(0); ThemePark.getInstance().getAPI().getAttractionService().removeRegion(region.getID()); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully removed region &f"+region.getID())); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully removed region &f"+region.getID())); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountAddCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountAddCommand.java index e277abb..86b4fbc 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountAddCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountAddCommand.java @@ -36,7 +36,7 @@ public class RideCountAddCommand extends SubCommand { ); sender.sendMessage(Text.color( - "&6&lThemeParkMC &f➢ &aSuccessfully added count of: &6"+amount+"x &ato attraction: &f"+attraction.getID()+" &afor &6"+players.size()+" &aplayers" + "&6&lThemePark &f➢ &aSuccessfully added count of: &6"+amount+"x &ato attraction: &f"+attraction.getID()+" &afor &6"+players.size()+" &aplayers" )); } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountChangeTotalTypeCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountChangeTotalTypeCommand.java index 54cbf56..ea9d979 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountChangeTotalTypeCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountChangeTotalTypeCommand.java @@ -22,7 +22,7 @@ public class RideCountChangeTotalTypeCommand extends SubCommand { TotalType type = (TotalType) list.get(0); ThemePark.getInstance().getAPI().getRideCountService().setType(type); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ Changed total type for ridecount to: &f"+type.toString())); + sender.sendMessage(Text.color("&6&lThemePark &f➢ Changed total type for ridecount to: &f"+type.toString())); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountGetCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountGetCommand.java index 8f6d793..67a202b 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountGetCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/ridecount/RideCountGetCommand.java @@ -32,7 +32,7 @@ public class RideCountGetCommand extends SubCommand { ); sender.sendMessage(Text.color( - "&6&lThemeParkMC &f➢ You have ridden attraction: &f"+attraction.getID()+" &ffor &6"+(count == null ? 0 : count.getCount())+"x" + "&6&lThemePark &f➢ You have ridden attraction: &f"+attraction.getID()+" &ffor &6"+(count == null ? 0 : count.getCount())+"x" )); } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusColorCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusColorCommand.java index d015d22..a1d034b 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusColorCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusColorCommand.java @@ -24,7 +24,7 @@ public class StatusColorCommand extends SubCommand { Status status = (Status) list.get(0); String color = (String) list.get(1); status.setColor(color); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed the color of status &f"+status.toString())); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed the color of status &f"+status.toString())); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusHexColorCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusHexColorCommand.java index b7eeeae..46782ad 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusHexColorCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusHexColorCommand.java @@ -25,7 +25,7 @@ public class StatusHexColorCommand extends SubCommand { Status status = (Status) list.get(0); String hex_color = (String) list.get(1); status.setHexColor(hex_color); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed the hex color of status &f"+status.toString())); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed the hex color of status &f"+status.toString())); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusMaterialCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusMaterialCommand.java index b4abd5f..e74746b 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusMaterialCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusMaterialCommand.java @@ -25,7 +25,7 @@ public class StatusMaterialCommand extends SubCommand { XMaterial material = (XMaterial) list.get(1); status.setMaterial(material); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed the material of status &f"+ status)); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed the material of status &f"+ status)); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusNameCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusNameCommand.java index 1d0a3d1..f87ecf4 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusNameCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusNameCommand.java @@ -23,7 +23,7 @@ public class StatusNameCommand extends SubCommand { Status status = (Status) list.get(0); String name = (String) list.get(1); status.setName(name); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed the name of status &f"+ status)); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed the name of status &f"+ status)); } } diff --git a/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusTeleportCommand.java b/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusTeleportCommand.java index 8854664..6c4f0f2 100644 --- a/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusTeleportCommand.java +++ b/src/main/java/nl/iobyte/themepark/commands/subcommands/status/StatusTeleportCommand.java @@ -24,7 +24,7 @@ public class StatusTeleportCommand extends SubCommand { Status status = (Status) list.get(0); boolean b = (boolean) list.get(1); status.setCanTeleport(b); - sender.sendMessage(Text.color("&6&lThemeParkMC &f➢ &aSuccessfully changed if status &f"+status.toString()+" &acan teleport")); + sender.sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully changed if status &f"+status.toString()+" &acan teleport")); } } diff --git a/src/main/java/nl/iobyte/themepark/listeners/AttractionListener.java b/src/main/java/nl/iobyte/themepark/listeners/AttractionListener.java index 1efba0d..3684b26 100644 --- a/src/main/java/nl/iobyte/themepark/listeners/AttractionListener.java +++ b/src/main/java/nl/iobyte/themepark/listeners/AttractionListener.java @@ -38,7 +38,7 @@ public class AttractionListener implements Listener { ThemePark.getInstance().getAPI().getDatabaseService().executeAsync( "remote", "INSERT IGNORE INTO attractions(id, region_id, name, cover, status_id) VALUES (?,?,?,?,?)", - new HashMap() {{ + new HashMap<>() {{ put(1, attraction.getID()); put(2, attraction.getRegionID()); put(3, attraction.getName()); diff --git a/src/main/java/nl/iobyte/themepark/listeners/PlayerListener.java b/src/main/java/nl/iobyte/themepark/listeners/PlayerListener.java index 093dd65..5239b6c 100644 --- a/src/main/java/nl/iobyte/themepark/listeners/PlayerListener.java +++ b/src/main/java/nl/iobyte/themepark/listeners/PlayerListener.java @@ -138,7 +138,7 @@ public class PlayerListener implements Listener { e.setCancelled(true); Player player = e.getPlayer(); - Bukkit.dispatchCommand(player, "themepark menu"); + Bukkit.dispatchCommand(player, manager.getString(StorageKey.CMD)+" menu"); } //Handle Menu item drop diff --git a/src/main/java/nl/iobyte/themepark/listeners/StatusSignListener.java b/src/main/java/nl/iobyte/themepark/listeners/StatusSignListener.java index 3d6bc6d..3f20cd0 100644 --- a/src/main/java/nl/iobyte/themepark/listeners/StatusSignListener.java +++ b/src/main/java/nl/iobyte/themepark/listeners/StatusSignListener.java @@ -42,7 +42,8 @@ public class StatusSignListener implements Listener { Location location = e.getBlock().getLocation(); StatusSign statusSign = new StatusSign(attraction, location); - manager.addSign(statusSign); + if(manager.addSign(statusSign)) + e.getPlayer().sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully created a status sign")); } @EventHandler @@ -62,7 +63,9 @@ public class StatusSignListener implements Listener { Location location = e.getBlock().getLocation(); StatusSign s = new StatusSign(attraction, location); - manager.removeSign(s); + if(manager.removeSign(s)) + e.getPlayer().sendMessage(Text.color("&6&lThemePark &f➢ &aSuccessfully removed a status sign")); + } @EventHandler diff --git a/src/main/java/nl/iobyte/themepark/utils/StatusMessage.java b/src/main/java/nl/iobyte/themepark/utils/StatusMessage.java index 646bff0..dd56ccd 100644 --- a/src/main/java/nl/iobyte/themepark/utils/StatusMessage.java +++ b/src/main/java/nl/iobyte/themepark/utils/StatusMessage.java @@ -6,6 +6,7 @@ import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; import nl.iobyte.themepark.ThemePark; import nl.iobyte.themepark.api.attraction.objects.Attraction; +import nl.iobyte.themepark.api.config.enums.StorageKey; import nl.iobyte.themepark.api.config.enums.StorageLocation; import nl.iobyte.themepark.api.message.MessageKey; import nl.iobyte.themepark.api.message.Text; @@ -21,7 +22,7 @@ public class StatusMessage { public static void broadcast(Attraction attraction) { HashMap change = new HashMap<>(); change.put("{name}", attraction.getName()); - ClickEvent click = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/themepark attraction warp "+attraction.getID()); + ClickEvent click = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/"+ThemePark.getInstance().getAPI().getConfigurationManager().getString(StorageKey.CMD)+" attraction warp "+attraction.getID()); HoverEvent hover = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Text.color(ThemePark.getInstance().getAPI().getConfigurationManager().getString(StorageLocation.MESSAGE, "attraction.changed.hover")))); if(hover.getValue()[0].toPlainText().isEmpty()) hover = null; diff --git a/src/main/java/nl/iobyte/themepark/utils/UpdateManager.java b/src/main/java/nl/iobyte/themepark/utils/UpdateManager.java index b334315..2da9ef3 100644 --- a/src/main/java/nl/iobyte/themepark/utils/UpdateManager.java +++ b/src/main/java/nl/iobyte/themepark/utils/UpdateManager.java @@ -95,34 +95,31 @@ public class UpdateManager { public void check() { Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> { try { - BufferedReader in = null; + HttpsURLConnection con; if (type == CheckType.SPIGOT) { - HttpsURLConnection con = (HttpsURLConnection) new URL(String.format(SPIGOT_API, this.resourceID)).openConnection(); - con.setRequestMethod("GET"); - con.setRequestProperty("User-Agent", "Mozilla/5.0"); + con = (HttpsURLConnection) new URL(String.format(SPIGOT_API, this.resourceID)).openConnection(); - in = new BufferedReader(new InputStreamReader(con.getInputStream())); } else if (type == CheckType.SBDPLUGINS) { - HttpsURLConnection con = (HttpsURLConnection) new URL(String.format(SBDPLUGINS_API, this.resourceID)).openConnection(); - con.setRequestMethod("GET"); - con.setRequestProperty("User-Agent", "Mozilla/5.0"); - - in = new BufferedReader(new InputStreamReader(con.getInputStream())); + con = (HttpsURLConnection) new URL(String.format(SBDPLUGINS_API, this.resourceID)).openConnection(); + } else { + return; } - - if (in == null) return; + con.setRequestMethod("GET"); + con.setRequestProperty("User-Agent", "Mozilla/5.0"); + BufferedReader in = new BufferedReader( + new InputStreamReader(con.getInputStream()) + ); String version; String inputLine; StringBuilder response = new StringBuilder(); - while ((inputLine = in.readLine()) != null) { + while ((inputLine = in.readLine()) != null) response.append(inputLine); - } + in.close(); JsonParser parser = new JsonParser(); - if (type == CheckType.SPIGOT) { JsonArray array = parser.parse(response.toString()).getAsJsonArray(); diff --git a/src/main/resources/message.yml b/src/main/resources/message.yml index ae8ef56..ca7a252 100644 --- a/src/main/resources/message.yml +++ b/src/main/resources/message.yml @@ -1,6 +1,6 @@ -version: 1.1 +version: 1.2 -prefix: '&6&lThemeParkMC &r&f➢' +prefix: '&6&lThemePark &f➢&r' menu: previous: "&6&L\u23F4 Previous" @@ -13,7 +13,7 @@ ridecount: attraction: changed: hover: "&6Click to Warp" - CONSTRUCTION: "{prefix} &fAttraction: {name} &fis now &7Under Construction" + CONSTRUCTION: "{prefix} &fAttraction: &r{name} &fis now &7Under Construction" OPEN: "{prefix} &fAttraction: [TP]&r{name}[/TP] &fhas been &aOpened" CLOSED: "{prefix} &fAttraction: &r{name} &fhas been &4Closed" MAINTENANCE: "{prefix} &fAttraction: &r{name} &fis now in &6Maintenance" diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5f71d45..0ecc813 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: ThemePark -version: 3.1.0 +version: '${project.version}' author: IOByte website: 'https://www.iobyte.nl' main: nl.iobyte.themepark.ThemePark diff --git a/src/main/resources/settings.yml b/src/main/resources/settings.yml index a55ceb8..41721ac 100644 --- a/src/main/resources/settings.yml +++ b/src/main/resources/settings.yml @@ -18,5 +18,5 @@ mysql: sign: status: - name: '[ThemeParkMC]' - title: '&f[&6&lThemeParkMC&f]' \ No newline at end of file + name: '[ThemePark]' + title: '&f[&6&lThemePark&f]' \ No newline at end of file