Fixes
This commit is contained in:
parent
ce792b2226
commit
3eab1d3a4e
6 changed files with 90 additions and 2 deletions
13
pom.xml
13
pom.xml
|
@ -13,6 +13,13 @@
|
||||||
<artifactId>themepark</artifactId>
|
<artifactId>themepark</artifactId>
|
||||||
<version>1.2.2</version>
|
<version>1.2.2</version>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>placeholderapi</id>
|
||||||
|
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
|
@ -20,5 +27,11 @@
|
||||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.clip</groupId>
|
||||||
|
<artifactId>placeholderapi</artifactId>
|
||||||
|
<version>2.0.6</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -12,6 +12,7 @@ import me.paradoxpixel.themepark.listener.ClickListener;
|
||||||
import me.paradoxpixel.themepark.listener.ChangeListener;
|
import me.paradoxpixel.themepark.listener.ChangeListener;
|
||||||
import me.paradoxpixel.themepark.listener.PlayerListener;
|
import me.paradoxpixel.themepark.listener.PlayerListener;
|
||||||
import me.paradoxpixel.themepark.listener.SignListener;
|
import me.paradoxpixel.themepark.listener.SignListener;
|
||||||
|
import me.paradoxpixel.themepark.placeholder.ThemeParkPlaceholder;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandMap;
|
import org.bukkit.command.CommandMap;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
@ -45,6 +46,9 @@ public class ThemeParkPlugin extends JavaPlugin {
|
||||||
private void loadData() {
|
private void loadData() {
|
||||||
StatusManager.load();
|
StatusManager.load();
|
||||||
AttractionMenu.load();
|
AttractionMenu.load();
|
||||||
|
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||||
|
new ThemeParkPlaceholder(this).hook();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadDatabase() {
|
private void loadDatabase() {
|
||||||
|
|
|
@ -64,10 +64,16 @@ public class Attraction {
|
||||||
if(location == this.location)
|
if(location == this.location)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(LocationUtils.toString(location) != null && LocationUtils.toString(location) != null)
|
if(location == null)
|
||||||
if(LocationUtils.toString(this.location).equals(LocationUtils.toString(location)))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(LocationUtils.toString(location) == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(LocationUtils.toString(this.location) != null && LocationUtils.toString(location) != null)
|
||||||
|
if(LocationUtils.toString(this.location).equals(LocationUtils.toString(location)))
|
||||||
|
return;
|
||||||
|
|
||||||
ChangeAttractionEvent event = new ChangeAttractionEvent(this, name, name, region_id, region_id, this.location, location, type, type);
|
ChangeAttractionEvent event = new ChangeAttractionEvent(this, name, name, region_id, region_id, this.location, location, type, type);
|
||||||
this.location = location;
|
this.location = location;
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
public class GUIListener implements Listener {
|
public class GUIListener implements Listener {
|
||||||
|
@ -26,4 +27,16 @@ public class GUIListener implements Listener {
|
||||||
e.setCancelled(gui.execute(player, slot, type));
|
e.setCancelled(gui.execute(player, slot, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onMove(InventoryMoveItemEvent e) {
|
||||||
|
if(e.getDestination() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Inventory inventory = e.getDestination();
|
||||||
|
if(!(inventory.getHolder() instanceof GUIHolder))
|
||||||
|
return;
|
||||||
|
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package me.paradoxpixel.themepark.placeholder;
|
||||||
|
|
||||||
|
import me.paradoxpixel.themepark.ThemeParkPlugin;
|
||||||
|
import me.paradoxpixel.themepark.api.API;
|
||||||
|
import me.paradoxpixel.themepark.api.attraction.component.Status;
|
||||||
|
import me.paradoxpixel.themepark.attraction.status.StatusManager;
|
||||||
|
import me.paradoxpixel.themepark.utils.Utils;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import me.clip.placeholderapi.external.EZPlaceholderHook;
|
||||||
|
|
||||||
|
public class ThemeParkPlaceholder extends EZPlaceholderHook {
|
||||||
|
|
||||||
|
public ThemeParkPlaceholder(ThemeParkPlugin plugin) {
|
||||||
|
super(plugin, "tp");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onPlaceholderRequest(Player player, String identifier) {
|
||||||
|
if(identifier == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if(identifier.startsWith("status")) {
|
||||||
|
String[] args = identifier.split(":");
|
||||||
|
if(args.length < 2)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
String id = args[1];
|
||||||
|
if(!API.isAttraction(id))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
Status status = API.getAttraction(id).getStatus();
|
||||||
|
return Utils.color(StatusManager.getName(status));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(identifier.startsWith("name")) {
|
||||||
|
String[] args = identifier.split(":");
|
||||||
|
if(args.length < 2)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
String id = args[1];
|
||||||
|
if(!API.isAttraction(id))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
String name = API.getAttraction(id).getName();
|
||||||
|
return Utils.color(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,5 +2,6 @@ name: ThemePark
|
||||||
version: 1.2.2
|
version: 1.2.2
|
||||||
main: me.paradoxpixel.themepark.ThemeParkPlugin
|
main: me.paradoxpixel.themepark.ThemeParkPlugin
|
||||||
author: ParadoxPixel
|
author: ParadoxPixel
|
||||||
|
softdepend: [PlaceholderAPI]
|
||||||
commands:
|
commands:
|
||||||
status:
|
status:
|
Reference in a new issue