Added message to sign creation/removal
Fixed name errors
This commit is contained in:
parent
f8a6df8479
commit
06b579ee27
35 changed files with 107 additions and 63 deletions
|
@ -5,7 +5,22 @@
|
||||||
<artifactId>themepark</artifactId>
|
<artifactId>themepark</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.1.0</version>
|
||||||
<build>
|
<build>
|
||||||
|
<defaultGoal>clean package</defaultGoal>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<finalName>ThemePark v${project.version}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<release>11</release>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.2.0</version>
|
||||||
|
|
16
pom.xml
16
pom.xml
|
@ -113,7 +113,23 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<defaultGoal>clean package</defaultGoal>
|
||||||
|
<finalName>ThemePark v${project.version}</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<release>11</release>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package nl.iobyte.themepark.api.menu.objects;
|
package nl.iobyte.themepark.api.menu.objects;
|
||||||
|
|
||||||
|
import com.cryptomorin.xseries.XMaterial;
|
||||||
import nl.iobyte.menuapi.MenuAPI;
|
import nl.iobyte.menuapi.MenuAPI;
|
||||||
import nl.iobyte.menuapi.action.HandlerAction;
|
import nl.iobyte.menuapi.action.HandlerAction;
|
||||||
import nl.iobyte.menuapi.basic.Menu;
|
import nl.iobyte.menuapi.basic.Menu;
|
||||||
|
@ -59,10 +60,14 @@ public class MainMenu {
|
||||||
if(name == null || name.equals(""))
|
if(name == null || name.equals(""))
|
||||||
name = " ";
|
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)
|
if(material == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Material m = material.parseMaterial();
|
||||||
|
if(m == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
int amount = manager.getInt(StorageLocation.MENU, path+".amount");
|
int amount = manager.getInt(StorageLocation.MENU, path+".amount");
|
||||||
if(amount < 1)
|
if(amount < 1)
|
||||||
amount = 1;
|
amount = 1;
|
||||||
|
@ -71,7 +76,7 @@ public class MainMenu {
|
||||||
if(data < 0)
|
if(data < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
builder = new ItemBuilder(material, amount, data);
|
builder = new ItemBuilder(m, amount, data);
|
||||||
builder.setName(name);
|
builder.setName(name);
|
||||||
|
|
||||||
String lore = manager.getString(StorageLocation.MENU, path+".lore");
|
String lore = manager.getString(StorageLocation.MENU, path+".lore");
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package nl.iobyte.themepark.api.menu.objects.actions;
|
package nl.iobyte.themepark.api.menu.objects.actions;
|
||||||
|
|
||||||
import nl.iobyte.menuapi.action.MenuAction;
|
import nl.iobyte.menuapi.action.MenuAction;
|
||||||
|
import nl.iobyte.themepark.ThemePark;
|
||||||
import nl.iobyte.themepark.api.attraction.objects.Attraction;
|
import nl.iobyte.themepark.api.attraction.objects.Attraction;
|
||||||
|
import nl.iobyte.themepark.api.config.enums.StorageKey;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -14,7 +16,7 @@ public class TPAction extends MenuAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void execute(Player player) {
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,21 +19,22 @@ public class SignManager {
|
||||||
return signs;
|
return signs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSign(StatusSign sign) {
|
public boolean addSign(StatusSign sign) {
|
||||||
if(sign == null || sign.getLocation() == null)
|
if(sign == null || sign.getLocation() == null)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if(!(sign.getLocation().getBlock().getState() instanceof Sign))
|
if(!(sign.getLocation().getBlock().getState() instanceof Sign))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if(signs.containsKey(sign.getAttraction())) {
|
if(signs.containsKey(sign.getAttraction())) {
|
||||||
signs.get(sign.getAttraction()).add(sign);
|
signs.get(sign.getAttraction()).add(sign);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<StatusSign> array = new ArrayList<>();
|
ArrayList<StatusSign> array = new ArrayList<>();
|
||||||
array.add(sign);
|
array.add(sign);
|
||||||
signs.put(sign.getAttraction(), array);
|
signs.put(sign.getAttraction(), array);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSigns(Attraction attraction) {
|
public boolean hasSigns(Attraction attraction) {
|
||||||
|
@ -84,36 +85,40 @@ public class SignManager {
|
||||||
ThemePark.getInstance().getAPI().getConfigurationManager().set(StorageLocation.SIGN_DATA, "signs."+attraction.getID(), null);
|
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)
|
if(sign == null || sign.getLocation() == null || sign.getAttraction() == null)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if(!hasSigns(sign.getAttraction()))
|
if(!hasSigns(sign.getAttraction()))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
|
String str2;
|
||||||
Location loc1 = sign.getLocation();
|
Location loc1 = sign.getLocation();
|
||||||
String str1 = LocationUtil.toString(loc1);
|
String str1 = LocationUtil.toString(loc1);
|
||||||
ArrayList<StatusSign> array = signs.get(sign.getAttraction());
|
ArrayList<StatusSign> array = signs.get(sign.getAttraction());
|
||||||
|
boolean b = false;
|
||||||
for(StatusSign s : new ArrayList<>(array)) {
|
for(StatusSign s : new ArrayList<>(array)) {
|
||||||
Location loc2 = s.getLocation();
|
Location loc2 = s.getLocation();
|
||||||
if(loc1 == null || loc2 == null)
|
if(loc1 == null || loc2 == null)
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
String str2 = LocationUtil.toString(loc2);
|
|
||||||
|
|
||||||
|
str2 = LocationUtil.toString(loc2);
|
||||||
if(!str1.equals(str2))
|
if(!str1.equals(str2))
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
array.remove(s);
|
array.remove(s);
|
||||||
|
b = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(array.isEmpty()) {
|
if(array.isEmpty()) {
|
||||||
signs.remove(sign.getAttraction());
|
signs.remove(sign.getAttraction());
|
||||||
ThemePark.getInstance().getAPI().getConfigurationManager().set(StorageLocation.SIGN_DATA, "signs."+sign.getAttraction().getID(), null);
|
ThemePark.getInstance().getAPI().getConfigurationManager().set(StorageLocation.SIGN_DATA, "signs."+sign.getAttraction().getID(), null);
|
||||||
return;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
signs.put(sign.getAttraction(), array);
|
signs.put(sign.getAttraction(), array);
|
||||||
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class ItemCommand extends SubCommand {
|
||||||
Player player = (Player) sender.getOriginal();
|
Player player = (Player) sender.getOriginal();
|
||||||
player.getInventory().addItem(builder.getItem());
|
player.getInventory().addItem(builder.getItem());
|
||||||
player.updateInventory();
|
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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,6 @@ public class AttractionCoverCommand extends SubCommand {
|
||||||
Attraction attraction = (Attraction) list.get(0);
|
Attraction attraction = (Attraction) list.get(0);
|
||||||
String url = (String) list.get(1);
|
String url = (String) list.get(1);
|
||||||
attraction.setCover(url);
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class AttractionCreateCommand extends SubCommand {
|
||||||
status,
|
status,
|
||||||
location
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class AttractionListCommand extends SubCommand {
|
||||||
private void sendMultiPage(ICommandExecutor sender, int page, String title, Collection<Attraction> attractions) {
|
private void sendMultiPage(ICommandExecutor sender, int page, String title, Collection<Attraction> attractions) {
|
||||||
int pages = (int) Math.ceil(((double) attractions.size()) / 5);
|
int pages = (int) Math.ceil(((double) attractions.size()) / 5);
|
||||||
if(page < 1 || page > pages) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class AttractionLocationCommand extends SubCommand {
|
||||||
Attraction attraction = (Attraction) list.get(0);
|
Attraction attraction = (Attraction) list.get(0);
|
||||||
Player player = (Player) sender.getOriginal();
|
Player player = (Player) sender.getOriginal();
|
||||||
attraction.setLocation(player.getLocation());
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class AttractionNameCommand extends SubCommand {
|
||||||
Attraction attraction = (Attraction) list.get(0);
|
Attraction attraction = (Attraction) list.get(0);
|
||||||
String name = (String) list.get(1);
|
String name = (String) list.get(1);
|
||||||
attraction.setName(name);
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class AttractionRegionCommand extends SubCommand {
|
||||||
Attraction attraction = (Attraction) list.get(0);
|
Attraction attraction = (Attraction) list.get(0);
|
||||||
Region region = (Region) list.get(1);
|
Region region = (Region) list.get(1);
|
||||||
attraction.setRegionID(region.getID());
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class AttractionRemoveCommand extends SubCommand {
|
||||||
public void onCommand(ICommandExecutor sender, List<Object> list, int i) {
|
public void onCommand(ICommandExecutor sender, List<Object> list, int i) {
|
||||||
Attraction attraction = (Attraction) list.get(0);
|
Attraction attraction = (Attraction) list.get(0);
|
||||||
ThemePark.getInstance().getAPI().getAttractionService().removeAttraction(attraction.getID());
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class AttractionStatusCommand extends SubCommand {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
attraction.setStatus(status);
|
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()));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class AttractionWarpCommand extends SubCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(attraction.getLocation() == null) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class RegionCreateCommand extends SubCommand {
|
||||||
id,
|
id,
|
||||||
name
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class RegionListCommand extends SubCommand {
|
||||||
page = (Integer) list.get(0);
|
page = (Integer) list.get(0);
|
||||||
|
|
||||||
if(page < 1 || page > pages) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class RegionNameCommand extends SubCommand {
|
||||||
Region region = (Region) list.get(0);
|
Region region = (Region) list.get(0);
|
||||||
String name = (String) list.get(1);
|
String name = (String) list.get(1);
|
||||||
region.setName(name);
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class RegionRemoveCommand extends SubCommand {
|
||||||
public void onCommand(ICommandExecutor sender, List<Object> list, int i) {
|
public void onCommand(ICommandExecutor sender, List<Object> list, int i) {
|
||||||
Region region = (Region) list.get(0);
|
Region region = (Region) list.get(0);
|
||||||
ThemePark.getInstance().getAPI().getAttractionService().removeRegion(region.getID());
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class RideCountAddCommand extends SubCommand {
|
||||||
);
|
);
|
||||||
|
|
||||||
sender.sendMessage(Text.color(
|
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"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class RideCountChangeTotalTypeCommand extends SubCommand {
|
||||||
TotalType type = (TotalType) list.get(0);
|
TotalType type = (TotalType) list.get(0);
|
||||||
|
|
||||||
ThemePark.getInstance().getAPI().getRideCountService().setType(type);
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class RideCountGetCommand extends SubCommand {
|
||||||
);
|
);
|
||||||
|
|
||||||
sender.sendMessage(Text.color(
|
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"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class StatusColorCommand extends SubCommand {
|
||||||
Status status = (Status) list.get(0);
|
Status status = (Status) list.get(0);
|
||||||
String color = (String) list.get(1);
|
String color = (String) list.get(1);
|
||||||
status.setColor(color);
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class StatusHexColorCommand extends SubCommand {
|
||||||
Status status = (Status) list.get(0);
|
Status status = (Status) list.get(0);
|
||||||
String hex_color = (String) list.get(1);
|
String hex_color = (String) list.get(1);
|
||||||
status.setHexColor(hex_color);
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class StatusMaterialCommand extends SubCommand {
|
||||||
XMaterial material = (XMaterial) list.get(1);
|
XMaterial material = (XMaterial) list.get(1);
|
||||||
|
|
||||||
status.setMaterial(material);
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class StatusNameCommand extends SubCommand {
|
||||||
Status status = (Status) list.get(0);
|
Status status = (Status) list.get(0);
|
||||||
String name = (String) list.get(1);
|
String name = (String) list.get(1);
|
||||||
status.setName(name);
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class StatusTeleportCommand extends SubCommand {
|
||||||
Status status = (Status) list.get(0);
|
Status status = (Status) list.get(0);
|
||||||
boolean b = (boolean) list.get(1);
|
boolean b = (boolean) list.get(1);
|
||||||
status.setCanTeleport(b);
|
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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class AttractionListener implements Listener {
|
||||||
ThemePark.getInstance().getAPI().getDatabaseService().executeAsync(
|
ThemePark.getInstance().getAPI().getDatabaseService().executeAsync(
|
||||||
"remote",
|
"remote",
|
||||||
"INSERT IGNORE INTO attractions(id, region_id, name, cover, status_id) VALUES (?,?,?,?,?)",
|
"INSERT IGNORE INTO attractions(id, region_id, name, cover, status_id) VALUES (?,?,?,?,?)",
|
||||||
new HashMap<Integer, Object>() {{
|
new HashMap<>() {{
|
||||||
put(1, attraction.getID());
|
put(1, attraction.getID());
|
||||||
put(2, attraction.getRegionID());
|
put(2, attraction.getRegionID());
|
||||||
put(3, attraction.getName());
|
put(3, attraction.getName());
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class PlayerListener implements Listener {
|
||||||
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
Bukkit.dispatchCommand(player, "themepark menu");
|
Bukkit.dispatchCommand(player, manager.getString(StorageKey.CMD)+" menu");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle Menu item drop
|
//Handle Menu item drop
|
||||||
|
|
|
@ -42,7 +42,8 @@ public class StatusSignListener implements Listener {
|
||||||
|
|
||||||
Location location = e.getBlock().getLocation();
|
Location location = e.getBlock().getLocation();
|
||||||
StatusSign statusSign = new StatusSign(attraction, location);
|
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
|
@EventHandler
|
||||||
|
@ -62,7 +63,9 @@ public class StatusSignListener implements Listener {
|
||||||
Location location = e.getBlock().getLocation();
|
Location location = e.getBlock().getLocation();
|
||||||
|
|
||||||
StatusSign s = new StatusSign(attraction, location);
|
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
|
@EventHandler
|
||||||
|
|
|
@ -6,6 +6,7 @@ import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import nl.iobyte.themepark.ThemePark;
|
import nl.iobyte.themepark.ThemePark;
|
||||||
import nl.iobyte.themepark.api.attraction.objects.Attraction;
|
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.config.enums.StorageLocation;
|
||||||
import nl.iobyte.themepark.api.message.MessageKey;
|
import nl.iobyte.themepark.api.message.MessageKey;
|
||||||
import nl.iobyte.themepark.api.message.Text;
|
import nl.iobyte.themepark.api.message.Text;
|
||||||
|
@ -21,7 +22,7 @@ public class StatusMessage {
|
||||||
public static void broadcast(Attraction attraction) {
|
public static void broadcast(Attraction attraction) {
|
||||||
HashMap<String, String> change = new HashMap<>();
|
HashMap<String, String> change = new HashMap<>();
|
||||||
change.put("{name}", attraction.getName());
|
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"))));
|
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())
|
if(hover.getValue()[0].toPlainText().isEmpty())
|
||||||
hover = null;
|
hover = null;
|
||||||
|
|
|
@ -95,34 +95,31 @@ public class UpdateManager {
|
||||||
public void check() {
|
public void check() {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
||||||
try {
|
try {
|
||||||
BufferedReader in = null;
|
HttpsURLConnection con;
|
||||||
if (type == CheckType.SPIGOT) {
|
if (type == CheckType.SPIGOT) {
|
||||||
HttpsURLConnection con = (HttpsURLConnection) new URL(String.format(SPIGOT_API, this.resourceID)).openConnection();
|
con = (HttpsURLConnection) new URL(String.format(SPIGOT_API, this.resourceID)).openConnection();
|
||||||
con.setRequestMethod("GET");
|
|
||||||
con.setRequestProperty("User-Agent", "Mozilla/5.0");
|
|
||||||
|
|
||||||
in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
|
||||||
} else if (type == CheckType.SBDPLUGINS) {
|
} else if (type == CheckType.SBDPLUGINS) {
|
||||||
HttpsURLConnection con = (HttpsURLConnection) new URL(String.format(SBDPLUGINS_API, this.resourceID)).openConnection();
|
con = (HttpsURLConnection) new URL(String.format(SBDPLUGINS_API, this.resourceID)).openConnection();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
con.setRequestProperty("User-Agent", "Mozilla/5.0");
|
con.setRequestProperty("User-Agent", "Mozilla/5.0");
|
||||||
|
BufferedReader in = new BufferedReader(
|
||||||
in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
new InputStreamReader(con.getInputStream())
|
||||||
}
|
);
|
||||||
|
|
||||||
if (in == null) return;
|
|
||||||
|
|
||||||
String version;
|
String version;
|
||||||
|
|
||||||
String inputLine;
|
String inputLine;
|
||||||
StringBuilder response = new StringBuilder();
|
StringBuilder response = new StringBuilder();
|
||||||
while ((inputLine = in.readLine()) != null) {
|
while ((inputLine = in.readLine()) != null)
|
||||||
response.append(inputLine);
|
response.append(inputLine);
|
||||||
}
|
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
if (type == CheckType.SPIGOT) {
|
if (type == CheckType.SPIGOT) {
|
||||||
JsonArray array = parser.parse(response.toString()).getAsJsonArray();
|
JsonArray array = parser.parse(response.toString()).getAsJsonArray();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
version: 1.1
|
version: 1.2
|
||||||
|
|
||||||
prefix: '&6&lThemeParkMC &r&f➢'
|
prefix: '&6&lThemePark &f➢&r'
|
||||||
|
|
||||||
menu:
|
menu:
|
||||||
previous: "&6&L\u23F4 Previous"
|
previous: "&6&L\u23F4 Previous"
|
||||||
|
@ -13,7 +13,7 @@ ridecount:
|
||||||
attraction:
|
attraction:
|
||||||
changed:
|
changed:
|
||||||
hover: "&6Click to Warp"
|
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"
|
OPEN: "{prefix} &fAttraction: [TP]&r{name}[/TP] &fhas been &aOpened"
|
||||||
CLOSED: "{prefix} &fAttraction: &r{name} &fhas been &4Closed"
|
CLOSED: "{prefix} &fAttraction: &r{name} &fhas been &4Closed"
|
||||||
MAINTENANCE: "{prefix} &fAttraction: &r{name} &fis now in &6Maintenance"
|
MAINTENANCE: "{prefix} &fAttraction: &r{name} &fis now in &6Maintenance"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: ThemePark
|
name: ThemePark
|
||||||
version: 3.1.0
|
version: '${project.version}'
|
||||||
author: IOByte
|
author: IOByte
|
||||||
website: 'https://www.iobyte.nl'
|
website: 'https://www.iobyte.nl'
|
||||||
main: nl.iobyte.themepark.ThemePark
|
main: nl.iobyte.themepark.ThemePark
|
||||||
|
|
|
@ -18,5 +18,5 @@ mysql:
|
||||||
|
|
||||||
sign:
|
sign:
|
||||||
status:
|
status:
|
||||||
name: '[ThemeParkMC]'
|
name: '[ThemePark]'
|
||||||
title: '&f[&6&lThemeParkMC&f]'
|
title: '&f[&6&lThemePark&f]'
|
Reference in a new issue