mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2024-09-26 04:02:58 +02:00
Reformatted code + fixed bug
This commit is contained in:
parent
b08330c04d
commit
f7277a68f9
4
pom.xml
4
pom.xml
@ -1,9 +1,9 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>de.butzlabben.world</groupId>
|
<groupId>de.butzlabben.world</groupId>
|
||||||
<artifactId>WorldSystem</artifactId>
|
<artifactId>WorldSystem</artifactId>
|
||||||
<version>2.4.6.2</version>
|
<version>2.4.6.3</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -6,11 +6,11 @@ package de.butzlabben.inventory;
|
|||||||
*/
|
*/
|
||||||
public class CostumInv extends OrcInventory {
|
public class CostumInv extends OrcInventory {
|
||||||
|
|
||||||
public CostumInv(String title, int rows) {
|
public CostumInv(String title, int rows) {
|
||||||
super(title, rows);
|
super(title, rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CostumInv(String title, int rows, boolean fill) {
|
public CostumInv(String title, int rows, boolean fill) {
|
||||||
super(title, rows, fill);
|
super(title, rows, fill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public interface DependListener {
|
public interface DependListener {
|
||||||
|
|
||||||
ItemStack getItemStack(Player p, WorldPlayer wp);
|
ItemStack getItemStack(Player p, WorldPlayer wp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package de.butzlabben.inventory;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public interface OrcClickListener {
|
public interface OrcClickListener {
|
||||||
|
|
||||||
void onClick(Player p, OrcInventory inv, OrcItem item);
|
void onClick(Player p, OrcInventory inv, OrcItem item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,101 +11,100 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public abstract class OrcInventory {
|
public abstract class OrcInventory {
|
||||||
|
|
||||||
protected String title;
|
|
||||||
private int rows;
|
|
||||||
private InventoryType type;
|
|
||||||
|
|
||||||
protected final HashMap<Integer, OrcItem> items = new HashMap<>();
|
protected final HashMap<Integer, OrcItem> items = new HashMap<>();
|
||||||
|
protected String title;
|
||||||
|
private int rows;
|
||||||
|
private InventoryType type;
|
||||||
|
|
||||||
public OrcInventory(String title) {
|
public OrcInventory(String title) {
|
||||||
Objects.requireNonNull(title, "title cannot be null");
|
Objects.requireNonNull(title, "title cannot be null");
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcInventory(String title, int rows) {
|
public OrcInventory(String title, int rows) {
|
||||||
this(title);
|
this(title);
|
||||||
if (rows <= 0 || rows > 6)
|
if (rows <= 0 || rows > 6)
|
||||||
throw new IllegalArgumentException("rows cannot be smaller than 1 or bigger than 6");
|
throw new IllegalArgumentException("rows cannot be smaller than 1 or bigger than 6");
|
||||||
this.rows = rows;
|
this.rows = rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcInventory(String title, int rows, boolean fill) {
|
|
||||||
this(title, rows);
|
|
||||||
if(fill) {
|
|
||||||
for (int i = 0; i < rows * 9; i++) {
|
|
||||||
items.put(i, OrcItem.fill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrcInventory(String title, InventoryType type) {
|
public OrcInventory(String title, int rows, boolean fill) {
|
||||||
this(title);
|
this(title, rows);
|
||||||
if (type == null || type == InventoryType.CHEST) {
|
if (fill) {
|
||||||
this.type = null;
|
for (int i = 0; i < rows * 9; i++) {
|
||||||
rows = 3;
|
items.put(i, OrcItem.fill);
|
||||||
} else {
|
}
|
||||||
this.type = type;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void addItem(int slot, OrcItem item) {
|
public OrcInventory(String title, InventoryType type) {
|
||||||
if (item == null) {
|
this(title);
|
||||||
removeItem(slot);
|
if (type == null || type == InventoryType.CHEST) {
|
||||||
} else {
|
this.type = null;
|
||||||
items.put(slot, item);
|
rows = 3;
|
||||||
}
|
} else {
|
||||||
}
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void addItem(int row, int col, OrcItem item) {
|
public void addItem(int slot, OrcItem item) {
|
||||||
addItem(row * 9 + col, item);
|
if (item == null) {
|
||||||
}
|
removeItem(slot);
|
||||||
|
} else {
|
||||||
|
items.put(slot, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void removeItem(int slot) {
|
public void addItem(int row, int col, OrcItem item) {
|
||||||
items.remove(slot);
|
addItem(row * 9 + col, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeItem(int row, int col) {
|
public void removeItem(int slot) {
|
||||||
removeItem(row * 9 + col);
|
items.remove(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Inventory getInventory(Player p) {
|
public void removeItem(int row, int col) {
|
||||||
return getInventory(p, title);
|
removeItem(row * 9 + col);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void redraw(Player p) {
|
|
||||||
p.closeInventory();
|
|
||||||
p.openInventory(getInventory(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Inventory getInventory(Player p, String title) {
|
public Inventory getInventory(Player p) {
|
||||||
Inventory inv;
|
return getInventory(p, title);
|
||||||
int size;
|
}
|
||||||
if (type == null) {
|
|
||||||
inv = Bukkit.createInventory(null, rows * 9, title);
|
|
||||||
size = rows * 9;
|
|
||||||
} else {
|
|
||||||
inv = Bukkit.createInventory(null, type, title);
|
|
||||||
size = type.getDefaultSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Entry<Integer, OrcItem> entry : items.entrySet()) {
|
public void redraw(Player p) {
|
||||||
if (entry.getKey() >= 0 && entry.getKey() < size) {
|
p.closeInventory();
|
||||||
inv.setItem(entry.getKey(), entry.getValue().getItemStack(p));
|
p.openInventory(getInventory(p));
|
||||||
} else {
|
}
|
||||||
System.err.println("There is a problem with a configured Item!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OrcListener.getInstance().register(p.getUniqueId(), this);
|
public Inventory getInventory(Player p, String title) {
|
||||||
|
Inventory inv;
|
||||||
return inv;
|
int size;
|
||||||
}
|
if (type == null) {
|
||||||
|
inv = Bukkit.createInventory(null, rows * 9, title);
|
||||||
|
size = rows * 9;
|
||||||
|
} else {
|
||||||
|
inv = Bukkit.createInventory(null, type, title);
|
||||||
|
size = type.getDefaultSize();
|
||||||
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
for (Entry<Integer, OrcItem> entry : items.entrySet()) {
|
||||||
this.title = title;
|
if (entry.getKey() >= 0 && entry.getKey() < size) {
|
||||||
}
|
inv.setItem(entry.getKey(), entry.getValue().getItemStack(p));
|
||||||
|
} else {
|
||||||
|
System.err.println("There is a problem with a configured Item!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
OrcListener.getInstance().register(p.getUniqueId(), this);
|
||||||
return title;
|
|
||||||
}
|
return inv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,130 +14,129 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public class OrcItem {
|
public class OrcItem {
|
||||||
|
|
||||||
public static OrcItem enabled;
|
public static final OrcItem error = new OrcItem(Material.BARRIER, null,
|
||||||
public static OrcItem disabled;
|
"§cERROR: Item is wrong configured!", "§cPath in config: see Displayname");
|
||||||
public static OrcItem coming_soon;
|
public static OrcItem enabled;
|
||||||
public static OrcItem back;
|
public static OrcItem disabled;
|
||||||
public static OrcItem fill;
|
public static OrcItem coming_soon;
|
||||||
public static final OrcItem error = new OrcItem(Material.BARRIER, null,
|
public static OrcItem back;
|
||||||
"§cERROR: Item is wrong configured!", "§cPath in config: see Displayname");
|
public static OrcItem fill;
|
||||||
|
private ItemStack is;
|
||||||
|
private OrcClickListener listener;
|
||||||
|
private DependListener depend;
|
||||||
|
private Runnable callback;
|
||||||
|
|
||||||
private ItemStack is;
|
public OrcItem(Material mat, String display, String... lore) {
|
||||||
private OrcClickListener listener;
|
setItemStack(mat, display, lore);
|
||||||
private DependListener depend;
|
}
|
||||||
private Runnable callback;
|
|
||||||
|
|
||||||
public void setCallback(Runnable r) {
|
public OrcItem(ItemStack is) {
|
||||||
callback = r;
|
setItemStack(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem(Material mat, String display, String... lore) {
|
public OrcItem(Material mat, String display, List<String> lore) {
|
||||||
setItemStack(mat, display, lore);
|
setItemStack(mat, (byte) 0, display, lore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem(ItemStack is) {
|
public OrcItem(Material mat) {
|
||||||
setItemStack(is);
|
this(new ItemStack(mat));
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem(Material mat, String display, List<String> lore) {
|
public OrcItem(Material material, byte data, String display, ArrayList<String> lore) {
|
||||||
setItemStack(mat, (byte) 0, display, lore);
|
setItemStack(material, data, display, lore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem(Material mat) {
|
public void setCallback(Runnable r) {
|
||||||
this(new ItemStack(mat));
|
callback = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem(Material material, byte data, String display, ArrayList<String> lore) {
|
@SuppressWarnings("deprecation")
|
||||||
setItemStack(material, data, display, lore);
|
public OrcItem setItemStack(Material mat, byte data, String display, List<String> lore) {
|
||||||
}
|
is = new ItemStack(mat, 1, data);
|
||||||
|
ItemMeta meta = is.getItemMeta();
|
||||||
|
meta.setDisplayName(display);
|
||||||
|
meta.setLore(lore);
|
||||||
|
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
is.setItemMeta(meta);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
public ItemStack getItemStack(Player p) {
|
||||||
public OrcItem setItemStack(Material mat, byte data, String display, List<String> lore) {
|
if (p != null && depend != null) {
|
||||||
is = new ItemStack(mat, 1 , data);
|
ItemStack is = depend.getItemStack(p, new WorldPlayer(p));
|
||||||
ItemMeta meta = is.getItemMeta();
|
if (is != null)
|
||||||
meta.setDisplayName(display);
|
return is;
|
||||||
meta.setLore(lore);
|
}
|
||||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
return is;
|
||||||
is.setItemMeta(meta);
|
}
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getItemStack(Player p) {
|
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
||||||
if (p != null && depend != null) {
|
if (p != null && depend != null) {
|
||||||
ItemStack is = depend.getItemStack(p, new WorldPlayer(p));
|
ItemStack is = depend.getItemStack(p, wp);
|
||||||
if (is != null)
|
if (is != null)
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
|
||||||
if (p != null && depend != null) {
|
|
||||||
ItemStack is = depend.getItemStack(p, wp);
|
|
||||||
if (is != null)
|
|
||||||
return is;
|
|
||||||
}
|
|
||||||
return is;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getItemStack() {
|
public ItemStack getItemStack() {
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem setOnClick(OrcClickListener listener) {
|
public OrcItem setItemStack(ItemStack is) {
|
||||||
this.listener = listener;
|
Objects.requireNonNull(is, "ItemStack cannot be null");
|
||||||
return this;
|
this.is = is;
|
||||||
}
|
ItemMeta meta = is.getItemMeta();
|
||||||
|
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
is.setItemMeta(meta);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public OrcItem onClick(Player p, OrcInventory inv) {
|
public OrcItem setOnClick(OrcClickListener listener) {
|
||||||
if (listener != null) {
|
this.listener = listener;
|
||||||
listener.onClick(p, inv, this);
|
return this;
|
||||||
}
|
}
|
||||||
if (callback != null)
|
|
||||||
callback.run();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrcItem setDisplay(String display) {
|
public OrcItem onClick(Player p, OrcInventory inv) {
|
||||||
ItemMeta meta = is.getItemMeta();
|
if (listener != null) {
|
||||||
meta.setDisplayName(display);
|
listener.onClick(p, inv, this);
|
||||||
is.setItemMeta(meta);
|
}
|
||||||
return this;
|
if (callback != null)
|
||||||
}
|
callback.run();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public OrcItem setLore(String... lore) {
|
public OrcItem setDisplay(String display) {
|
||||||
ItemMeta meta = is.getItemMeta();
|
ItemMeta meta = is.getItemMeta();
|
||||||
meta.setLore(Arrays.asList(lore));
|
meta.setDisplayName(display);
|
||||||
is.setItemMeta(meta);
|
is.setItemMeta(meta);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem removeLore() {
|
public OrcItem setLore(String... lore) {
|
||||||
ItemMeta meta = is.getItemMeta();
|
ItemMeta meta = is.getItemMeta();
|
||||||
meta.setLore(null);
|
meta.setLore(Arrays.asList(lore));
|
||||||
is.setItemMeta(meta);
|
is.setItemMeta(meta);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem setItemStack(ItemStack is) {
|
public OrcItem removeLore() {
|
||||||
Objects.requireNonNull(is, "ItemStack cannot be null");
|
ItemMeta meta = is.getItemMeta();
|
||||||
this.is = is;
|
meta.setLore(null);
|
||||||
ItemMeta meta = is.getItemMeta();
|
is.setItemMeta(meta);
|
||||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
return this;
|
||||||
is.setItemMeta(meta);
|
}
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrcItem setItemStack(Material mat, String display, String... lore) {
|
public OrcItem setItemStack(Material mat, String display, String... lore) {
|
||||||
return setItemStack(mat, (byte) 0, display, Arrays.asList(lore));
|
return setItemStack(mat, (byte) 0, display, Arrays.asList(lore));
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem setDepend(DependListener listener) {
|
public OrcItem setDepend(DependListener listener) {
|
||||||
depend = listener;
|
depend = listener;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem clone() {
|
public OrcItem clone() {
|
||||||
return new OrcItem(is);
|
return new OrcItem(is);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,38 +17,38 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public class OrcListener implements Listener {
|
public class OrcListener implements Listener {
|
||||||
|
|
||||||
private static OrcListener instance;
|
private static OrcListener instance;
|
||||||
|
|
||||||
private final HashMap<UUID, OrcInventory> invs = new HashMap<>();
|
|
||||||
|
|
||||||
public static synchronized OrcListener getInstance() {
|
private final HashMap<UUID, OrcInventory> invs = new HashMap<>();
|
||||||
if (instance == null)
|
|
||||||
instance = new OrcListener();
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private OrcListener() {
|
private OrcListener() {
|
||||||
Bukkit.getPluginManager().registerEvents(this, WorldSystem.getInstance());
|
Bukkit.getPluginManager().registerEvents(this, WorldSystem.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
public static synchronized OrcListener getInstance() {
|
||||||
public void on(InventoryClickEvent e) {
|
if (instance == null)
|
||||||
if (e.getClickedInventory() != null && invs.containsKey(e.getWhoClicked().getUniqueId())) {
|
instance = new OrcListener();
|
||||||
e.setCancelled(true);
|
return instance;
|
||||||
OrcItem item = invs.get(e.getWhoClicked().getUniqueId()).items.get(e.getSlot());
|
}
|
||||||
if (item != null)
|
|
||||||
item.onClick((Player) e.getWhoClicked(), invs.get(e.getWhoClicked().getUniqueId()));
|
@EventHandler
|
||||||
}
|
public void on(InventoryClickEvent e) {
|
||||||
}
|
if (e.getClickedInventory() != null && invs.containsKey(e.getWhoClicked().getUniqueId())) {
|
||||||
|
e.setCancelled(true);
|
||||||
public void register(UUID uuid, OrcInventory inv) {
|
OrcItem item = invs.get(e.getWhoClicked().getUniqueId()).items.get(e.getSlot());
|
||||||
invs.put(uuid, inv);
|
if (item != null)
|
||||||
}
|
item.onClick((Player) e.getWhoClicked(), invs.get(e.getWhoClicked().getUniqueId()));
|
||||||
|
}
|
||||||
@EventHandler
|
}
|
||||||
public void on(InventoryCloseEvent e) {
|
|
||||||
if (e.getInventory() != null) {
|
public void register(UUID uuid, OrcInventory inv) {
|
||||||
invs.remove(e.getPlayer().getUniqueId());
|
invs.put(uuid, inv);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@EventHandler
|
||||||
|
public void on(InventoryCloseEvent e) {
|
||||||
|
if (e.getInventory() != null) {
|
||||||
|
invs.remove(e.getPlayer().getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,48 +13,47 @@ import org.bukkit.inventory.Inventory;
|
|||||||
*/
|
*/
|
||||||
public class InventoryPage extends OrcInventory {
|
public class InventoryPage extends OrcInventory {
|
||||||
|
|
||||||
InventoryPage next, before = null;
|
InventoryPage next, before = null;
|
||||||
|
private int i = 0;
|
||||||
|
|
||||||
public InventoryPage(String title, int page, int pages) {
|
public InventoryPage(String title, int page, int pages) {
|
||||||
super(title, 6);
|
super(title, 6);
|
||||||
|
|
||||||
YamlConfiguration cfg = GuiConfig.getConfig();
|
YamlConfiguration cfg = GuiConfig.getConfig();
|
||||||
String path = "options.players.currentpage";
|
String path = "options.players.currentpage";
|
||||||
|
|
||||||
OrcItem oi = new OrcItem(GuiConfig.getMaterial(cfg, path), GuiConfig.getData(cfg, path),
|
OrcItem oi = new OrcItem(GuiConfig.getMaterial(cfg, path), GuiConfig.getData(cfg, path),
|
||||||
GuiConfig.getDisplay(cfg, path).replaceAll("%page", "" + page), GuiConfig.getLore(cfg, path));
|
GuiConfig.getDisplay(cfg, path).replaceAll("%page", "" + page), GuiConfig.getLore(cfg, path));
|
||||||
addItem(GuiConfig.getSlot(path), oi);
|
addItem(GuiConfig.getSlot(path), oi);
|
||||||
|
|
||||||
path = "options.players.pagebefore";
|
path = "options.players.pagebefore";
|
||||||
oi = GuiConfig.getItem(path);
|
oi = GuiConfig.getItem(path);
|
||||||
oi.setOnClick((p, inv, item) -> {
|
oi.setOnClick((p, inv, item) -> {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
p.openInventory(this.before.getInventory(p));
|
p.openInventory(this.before.getInventory(p));
|
||||||
});
|
});
|
||||||
addItem(GuiConfig.getSlot(path), oi);
|
addItem(GuiConfig.getSlot(path), oi);
|
||||||
|
|
||||||
path = "options.players.nextpage";
|
path = "options.players.nextpage";
|
||||||
oi = GuiConfig.getItem(path);
|
oi = GuiConfig.getItem(path);
|
||||||
oi.setOnClick((p, inv, item) -> {
|
oi.setOnClick((p, inv, item) -> {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
p.openInventory(this.next.getInventory(p));
|
p.openInventory(this.next.getInventory(p));
|
||||||
});
|
});
|
||||||
addItem(GuiConfig.getSlot(path), oi);
|
addItem(GuiConfig.getSlot(path), oi);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int i = 0;
|
@Override
|
||||||
|
public Inventory getInventory(Player p) {
|
||||||
|
return super.getInventory(p);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public void addItem(OrcItem item) {
|
||||||
public Inventory getInventory(Player p) {
|
if (i > 36) {
|
||||||
return super.getInventory(p);
|
System.err.println("More items than allowed in page view");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
public void addItem(OrcItem item) {
|
addItem(i, item);
|
||||||
if (i > 36) {
|
i++;
|
||||||
System.err.println("More items than allowed in page view");
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
addItem(i, item);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,6 @@ import de.butzlabben.inventory.OrcItem;
|
|||||||
*/
|
*/
|
||||||
public interface ItemConverter<T> {
|
public interface ItemConverter<T> {
|
||||||
|
|
||||||
OrcItem convert(T element);
|
OrcItem convert(T element);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,51 +14,51 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
public class PageGUICreator<T> {
|
public class PageGUICreator<T> {
|
||||||
|
|
||||||
private final int elementsPerPage;
|
private final int elementsPerPage;
|
||||||
private List<InventoryPage> invpages;
|
private List<InventoryPage> invpages;
|
||||||
|
|
||||||
public void create(String title, Collection<T> elements, ItemConverter<T> converter) {
|
public PageGUICreator() {
|
||||||
List<OrcItem> items = elements.stream().map(r -> converter.convert(r)).collect(Collectors.toList());
|
this(4 * 9);
|
||||||
if (items == null || items.size() == 0)
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
int pages = (int) (Math.ceil((items.size() / (double) elementsPerPage) < 1 ? 1 : Math.ceil((double) items.size() / (double) elementsPerPage)));
|
public PageGUICreator(int elementsPerPage) {
|
||||||
|
this.elementsPerPage = elementsPerPage;
|
||||||
|
}
|
||||||
|
|
||||||
invpages = new ArrayList<>(pages);
|
public void create(String title, Collection<T> elements, ItemConverter<T> converter) {
|
||||||
|
List<OrcItem> items = elements.stream().map(r -> converter.convert(r)).collect(Collectors.toList());
|
||||||
|
if (items == null || items.size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
for (int i = 1; i < pages + 1; i++) {
|
int pages = (int) (Math.ceil((items.size() / (double) elementsPerPage) < 1 ? 1 : Math.ceil((double) items.size() / (double) elementsPerPage)));
|
||||||
int start = i == 1 ? 0 : elementsPerPage * (i - 1);
|
|
||||||
int end = items.size() < elementsPerPage * i ? items.size() : elementsPerPage * i;
|
|
||||||
List<OrcItem> page = items.subList(start, end);
|
|
||||||
|
|
||||||
InventoryPage invpage = new InventoryPage(title, i, pages);
|
invpages = new ArrayList<>(pages);
|
||||||
page.forEach(invpage::addItem);
|
|
||||||
invpages.add(invpage);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < invpages.size(); i++) {
|
for (int i = 1; i < pages + 1; i++) {
|
||||||
|
int start = i == 1 ? 0 : elementsPerPage * (i - 1);
|
||||||
|
int end = items.size() < elementsPerPage * i ? items.size() : elementsPerPage * i;
|
||||||
|
List<OrcItem> page = items.subList(start, end);
|
||||||
|
|
||||||
int beforeIndex = i == 0 ? invpages.size() - 1 : i - 1;
|
InventoryPage invpage = new InventoryPage(title, i, pages);
|
||||||
int nextIndex = i == invpages.size() - 1 ? 0 : i + 1;
|
page.forEach(invpage::addItem);
|
||||||
|
invpages.add(invpage);
|
||||||
invpages.get(i).before = invpages.get(beforeIndex);
|
}
|
||||||
invpages.get(i).next = invpages.get(nextIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void show(Player p) {
|
for (int i = 0; i < invpages.size(); i++) {
|
||||||
p.openInventory(invpages.get(0).getInventory(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
public PageGUICreator() {
|
int beforeIndex = i == 0 ? invpages.size() - 1 : i - 1;
|
||||||
this(4 * 9);
|
int nextIndex = i == invpages.size() - 1 ? 0 : i + 1;
|
||||||
}
|
|
||||||
|
|
||||||
public List<InventoryPage> getInvPages() {
|
|
||||||
return invpages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PageGUICreator(int elementsPerPage) {
|
invpages.get(i).before = invpages.get(beforeIndex);
|
||||||
this.elementsPerPage = elementsPerPage;
|
invpages.get(i).next = invpages.get(nextIndex);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show(Player p) {
|
||||||
|
p.openInventory(invpages.get(0).getInventory(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<InventoryPage> getInvPages() {
|
||||||
|
return invpages;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ package de.butzlabben.world;
|
|||||||
|
|
||||||
public class GCRunnable implements Runnable {
|
public class GCRunnable implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
new Thread(() -> System.gc()).start();
|
new Thread(() -> System.gc()).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,113 +21,113 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class GameProfileBuilder {
|
public class GameProfileBuilder {
|
||||||
|
|
||||||
private static final Gson gson = new GsonBuilder().disableHtmlEscaping()
|
private static final Gson gson = new GsonBuilder().disableHtmlEscaping()
|
||||||
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
|
.registerTypeAdapter(UUID.class, new UUIDTypeAdapter())
|
||||||
.registerTypeAdapter(GameProfile.class, new GameProfileSerializer())
|
.registerTypeAdapter(GameProfile.class, new GameProfileSerializer())
|
||||||
.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create();
|
.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create();
|
||||||
private static final HashMap<UUID, CachedProfile> cache = new HashMap<>();
|
private static final HashMap<UUID, CachedProfile> cache = new HashMap<>();
|
||||||
private static long cacheTime = -1L;
|
private static final Object sync = new Object();
|
||||||
private static final Object sync = new Object();
|
private static long cacheTime = -1L;
|
||||||
|
|
||||||
public static GameProfile fetch(UUID uuid) throws IOException {
|
public static GameProfile fetch(UUID uuid) throws IOException {
|
||||||
return fetch(uuid, false);
|
return fetch(uuid, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameProfile fetch(UUID uuid, boolean forceNew) throws IOException {
|
public static GameProfile fetch(UUID uuid, boolean forceNew) throws IOException {
|
||||||
if ((!forceNew) && (cache.containsKey(uuid)) && (cache.get(uuid).isValid())) {
|
if ((!forceNew) && (cache.containsKey(uuid)) && (cache.get(uuid).isValid())) {
|
||||||
return cache.get(uuid).profile;
|
return cache.get(uuid).profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpURLConnection connection;
|
|
||||||
synchronized (sync) {
|
|
||||||
connection = (HttpURLConnection) new URL(
|
|
||||||
String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false",
|
|
||||||
UUIDTypeAdapter.fromUUID(uuid))).openConnection();
|
|
||||||
connection.setReadTimeout(5000);
|
|
||||||
}
|
|
||||||
if (connection.getResponseCode() == 200) {
|
|
||||||
String json = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine();
|
|
||||||
|
|
||||||
GameProfile result = gson.fromJson(json, GameProfile.class);
|
HttpURLConnection connection;
|
||||||
cache.put(uuid, new CachedProfile(result));
|
synchronized (sync) {
|
||||||
return result;
|
connection = (HttpURLConnection) new URL(
|
||||||
}
|
String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false",
|
||||||
if ((!forceNew) && (cache.containsKey(uuid))) {
|
UUIDTypeAdapter.fromUUID(uuid))).openConnection();
|
||||||
return cache.get(uuid).profile;
|
connection.setReadTimeout(5000);
|
||||||
}
|
}
|
||||||
throw new IOException("Could not connect to mojang servers for unknown player: " + uuid.toString());
|
if (connection.getResponseCode() == 200) {
|
||||||
}
|
String json = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine();
|
||||||
|
|
||||||
public static GameProfile getProfile(UUID uuid, String name, String skin) {
|
GameProfile result = gson.fromJson(json, GameProfile.class);
|
||||||
return getProfile(uuid, name, skin, null);
|
cache.put(uuid, new CachedProfile(result));
|
||||||
}
|
return result;
|
||||||
|
}
|
||||||
|
if ((!forceNew) && (cache.containsKey(uuid))) {
|
||||||
|
return cache.get(uuid).profile;
|
||||||
|
}
|
||||||
|
throw new IOException("Could not connect to mojang servers for unknown player: " + uuid.toString());
|
||||||
|
}
|
||||||
|
|
||||||
public static GameProfile getProfile(UUID uuid, String name, String skinUrl, String capeUrl) {
|
public static GameProfile getProfile(UUID uuid, String name, String skin) {
|
||||||
GameProfile profile = new GameProfile(uuid, name);
|
return getProfile(uuid, name, skin, null);
|
||||||
boolean cape = (capeUrl != null) && (!capeUrl.isEmpty());
|
}
|
||||||
|
|
||||||
List<Object> args = new ArrayList<>();
|
public static GameProfile getProfile(UUID uuid, String name, String skinUrl, String capeUrl) {
|
||||||
args.add(Long.valueOf(System.currentTimeMillis()));
|
GameProfile profile = new GameProfile(uuid, name);
|
||||||
args.add(UUIDTypeAdapter.fromUUID(uuid));
|
boolean cape = (capeUrl != null) && (!capeUrl.isEmpty());
|
||||||
args.add(name);
|
|
||||||
args.add(skinUrl);
|
|
||||||
if (cape) {
|
|
||||||
args.add(capeUrl);
|
|
||||||
}
|
|
||||||
profile.getProperties().put("textures",
|
|
||||||
new Property("textures",
|
|
||||||
Base64Coder.encodeString(String.format(
|
|
||||||
cape ? "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"},\"CAPE\":{\"url\":\"%s\"}}}"
|
|
||||||
: "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"}}}",
|
|
||||||
args.toArray(new Object[0])))));
|
|
||||||
return profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setCacheTime(long time) {
|
List<Object> args = new ArrayList<>();
|
||||||
cacheTime = time;
|
args.add(Long.valueOf(System.currentTimeMillis()));
|
||||||
}
|
args.add(UUIDTypeAdapter.fromUUID(uuid));
|
||||||
|
args.add(name);
|
||||||
|
args.add(skinUrl);
|
||||||
|
if (cape) {
|
||||||
|
args.add(capeUrl);
|
||||||
|
}
|
||||||
|
profile.getProperties().put("textures",
|
||||||
|
new Property("textures",
|
||||||
|
Base64Coder.encodeString(String.format(
|
||||||
|
cape ? "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"},\"CAPE\":{\"url\":\"%s\"}}}"
|
||||||
|
: "{\"timestamp\":%d,\"profileId\":\"%s\",\"profileName\":\"%s\",\"isPublic\":true,\"textures\":{\"SKIN\":{\"url\":\"%s\"}}}",
|
||||||
|
args.toArray(new Object[0])))));
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
private static class GameProfileSerializer implements JsonSerializer<GameProfile>, JsonDeserializer<GameProfile> {
|
public static void setCacheTime(long time) {
|
||||||
|
cacheTime = time;
|
||||||
|
}
|
||||||
|
|
||||||
public GameProfile deserialize(JsonElement json, Type type, JsonDeserializationContext context)
|
private static class GameProfileSerializer implements JsonSerializer<GameProfile>, JsonDeserializer<GameProfile> {
|
||||||
throws JsonParseException {
|
|
||||||
JsonObject object = (JsonObject) json;
|
|
||||||
UUID id = object.has("id") ? (UUID) context.deserialize(object.get("id"), UUID.class) : null;
|
|
||||||
String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null;
|
|
||||||
GameProfile profile = new GameProfile(id, name);
|
|
||||||
if (object.has("properties")) {
|
|
||||||
for (Map.Entry<String, Property> prop : ((PropertyMap) context.deserialize(object.get("properties"),
|
|
||||||
PropertyMap.class)).entries()) {
|
|
||||||
profile.getProperties().put(prop.getKey(), prop.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JsonElement serialize(GameProfile profile, Type type, JsonSerializationContext context) {
|
public GameProfile deserialize(JsonElement json, Type type, JsonDeserializationContext context)
|
||||||
JsonObject result = new JsonObject();
|
throws JsonParseException {
|
||||||
if (profile.getId() != null) {
|
JsonObject object = (JsonObject) json;
|
||||||
result.add("id", context.serialize(profile.getId()));
|
UUID id = object.has("id") ? (UUID) context.deserialize(object.get("id"), UUID.class) : null;
|
||||||
}
|
String name = object.has("name") ? object.getAsJsonPrimitive("name").getAsString() : null;
|
||||||
if (profile.getName() != null) {
|
GameProfile profile = new GameProfile(id, name);
|
||||||
result.addProperty("name", profile.getName());
|
if (object.has("properties")) {
|
||||||
}
|
for (Map.Entry<String, Property> prop : ((PropertyMap) context.deserialize(object.get("properties"),
|
||||||
if (!profile.getProperties().isEmpty()) {
|
PropertyMap.class)).entries()) {
|
||||||
result.add("properties", context.serialize(profile.getProperties()));
|
profile.getProperties().put(prop.getKey(), prop.getValue());
|
||||||
}
|
}
|
||||||
return result;
|
}
|
||||||
}
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class CachedProfile {
|
public JsonElement serialize(GameProfile profile, Type type, JsonSerializationContext context) {
|
||||||
private final GameProfile profile;
|
JsonObject result = new JsonObject();
|
||||||
|
if (profile.getId() != null) {
|
||||||
|
result.add("id", context.serialize(profile.getId()));
|
||||||
|
}
|
||||||
|
if (profile.getName() != null) {
|
||||||
|
result.addProperty("name", profile.getName());
|
||||||
|
}
|
||||||
|
if (!profile.getProperties().isEmpty()) {
|
||||||
|
result.add("properties", context.serialize(profile.getProperties()));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public CachedProfile(GameProfile profile) {
|
private static class CachedProfile {
|
||||||
this.profile = profile;
|
private final GameProfile profile;
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid() {
|
public CachedProfile(GameProfile profile) {
|
||||||
return GameProfileBuilder.cacheTime < 0L;
|
this.profile = profile;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return GameProfileBuilder.cacheTime < 0L;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,38 +11,38 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class WorldCheckerRunnable implements Runnable {
|
public class WorldCheckerRunnable implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (World world : Bukkit.getWorlds()) {
|
for (World world : Bukkit.getWorlds()) {
|
||||||
if (SystemWorld.getSystemWorld(world.getName()) == null || !SystemWorld.getSystemWorld(world.getName()).isLoaded())
|
if (SystemWorld.getSystemWorld(world.getName()) == null || !SystemWorld.getSystemWorld(world.getName()).isLoaded())
|
||||||
continue;
|
continue;
|
||||||
int other = world.getEntities().size() - world.getPlayers().size();
|
int other = world.getEntities().size() - world.getPlayers().size();
|
||||||
if (other > PluginConfig.getEntitysPerWorld()) {
|
if (other > PluginConfig.getEntitysPerWorld()) {
|
||||||
String worldname = world.getName();
|
String worldname = world.getName();
|
||||||
for (Entity e : world.getEntities()) {
|
for (Entity e : world.getEntities()) {
|
||||||
if (!(e instanceof Player)) {
|
if (!(e instanceof Player)) {
|
||||||
e.remove();
|
e.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String ownerofWorld = null;
|
String ownerofWorld = null;
|
||||||
for (OfflinePlayer p : Bukkit.getOfflinePlayers()) {
|
for (OfflinePlayer p : Bukkit.getOfflinePlayers()) {
|
||||||
if (p.getUniqueId().toString()
|
if (p.getUniqueId().toString()
|
||||||
.equals(worldname.substring(worldname.length() - 36)))
|
.equals(worldname.substring(worldname.length() - 36)))
|
||||||
ownerofWorld = p.getName();
|
ownerofWorld = p.getName();
|
||||||
}
|
}
|
||||||
StringBuilder members = new StringBuilder();
|
StringBuilder members = new StringBuilder();
|
||||||
for (Player p : world.getPlayers()) {
|
for (Player p : world.getPlayers()) {
|
||||||
members.append(p.getName()).append(" ");
|
members.append(p.getName()).append(" ");
|
||||||
}
|
}
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
if (!p.hasPermission("ws.lag"))
|
if (!p.hasPermission("ws.lag"))
|
||||||
continue;
|
continue;
|
||||||
p.sendMessage(MessageConfig.getLagDetection().replaceAll("%world",
|
p.sendMessage(MessageConfig.getLagDetection().replaceAll("%world",
|
||||||
ownerofWorld + " ( ID: " + world.getName().substring(2, worldname.length() - 37) + " )"));
|
ownerofWorld + " ( ID: " + world.getName().substring(2, worldname.length() - 37) + " )"));
|
||||||
p.sendMessage(MessageConfig.getPlayerList().replaceAll("%players", members.toString()));
|
p.sendMessage(MessageConfig.getPlayerList().replaceAll("%players", members.toString()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,11 +31,62 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class WorldSystem extends JavaPlugin {
|
public class WorldSystem extends JavaPlugin {
|
||||||
|
|
||||||
|
private static boolean is1_13Plus = false;
|
||||||
final private String version = this.getDescription().getVersion();
|
final private String version = this.getDescription().getVersion();
|
||||||
|
|
||||||
private CreatorAdapter creator;
|
private CreatorAdapter creator;
|
||||||
|
|
||||||
private static boolean is1_13Plus = false;
|
public static void createConfigs() {
|
||||||
|
File dir = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/worldsources");
|
||||||
|
File config = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "config.yml");
|
||||||
|
File dconfig = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "dependence.yml");
|
||||||
|
File languages = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/languages");
|
||||||
|
File gui = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "gui.yml");
|
||||||
|
if (!dir.exists()) {
|
||||||
|
dir.mkdirs();
|
||||||
|
}
|
||||||
|
if (!languages.exists())
|
||||||
|
languages.mkdirs();
|
||||||
|
PluginConfig.checkConfig(config);
|
||||||
|
|
||||||
|
// Done with #6
|
||||||
|
MessageConfig.checkConfig(new File(languages, "en.yml"));
|
||||||
|
|
||||||
|
MessageConfig.checkConfig(new File(languages, "de.yml"));
|
||||||
|
MessageConfig.checkConfig(new File(languages, "hu.yml"));
|
||||||
|
MessageConfig.checkConfig(new File(languages, "nl.yml"));
|
||||||
|
MessageConfig.checkConfig(new File(languages, "pl.yml"));
|
||||||
|
MessageConfig.checkConfig(new File(languages, "es.yml"));
|
||||||
|
MessageConfig.checkConfig(new File(languages, "ru.yml"));
|
||||||
|
MessageConfig.checkConfig(new File(languages, "fi.yml"));
|
||||||
|
// Here we are for #5
|
||||||
|
MessageConfig.checkConfig(new File(languages, "zh.yml"));
|
||||||
|
MessageConfig.checkConfig(new File(languages, "fr.yml"));
|
||||||
|
MessageConfig.checkConfig(new File(languages, PluginConfig.getLanguage() + ".yml"));
|
||||||
|
if (!dconfig.exists()) {
|
||||||
|
try {
|
||||||
|
dconfig.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Wasn't able to create DependenceConfig");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
new DependenceConfig();
|
||||||
|
}
|
||||||
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(config);
|
||||||
|
SettingsConfig.checkConfig();
|
||||||
|
File worlddir = new File(cfg.getString("worldfolder"));
|
||||||
|
if (!worlddir.exists()) {
|
||||||
|
worlddir.mkdirs();
|
||||||
|
}
|
||||||
|
GuiConfig.checkConfig(gui);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WorldSystem getInstance() {
|
||||||
|
return JavaPlugin.getPlugin(WorldSystem.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean is1_13() {
|
||||||
|
return is1_13Plus;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@ -117,7 +168,7 @@ public class WorldSystem extends JavaPlugin {
|
|||||||
DependenceConfig.checkWorlds();
|
DependenceConfig.checkWorlds();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI"))
|
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI"))
|
||||||
new PapiExtension().register();
|
new PapiExtension().register();
|
||||||
|
|
||||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Succesfully enabled WorldSystem v" + version);
|
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Succesfully enabled WorldSystem v" + version);
|
||||||
@ -139,60 +190,7 @@ public class WorldSystem extends JavaPlugin {
|
|||||||
.sendMessage(PluginConfig.getPrefix() + "Succesfully disabled WorldSystem v" + version);
|
.sendMessage(PluginConfig.getPrefix() + "Succesfully disabled WorldSystem v" + version);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createConfigs() {
|
|
||||||
File dir = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/worldsources");
|
|
||||||
File config = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "config.yml");
|
|
||||||
File dconfig = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "dependence.yml");
|
|
||||||
File languages = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/languages");
|
|
||||||
File gui = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "gui.yml");
|
|
||||||
if (!dir.exists()) {
|
|
||||||
dir.mkdirs();
|
|
||||||
}
|
|
||||||
if (!languages.exists())
|
|
||||||
languages.mkdirs();
|
|
||||||
PluginConfig.checkConfig(config);
|
|
||||||
|
|
||||||
// Done with #6
|
|
||||||
MessageConfig.checkConfig(new File(languages, "en.yml"));
|
|
||||||
|
|
||||||
MessageConfig.checkConfig(new File(languages, "de.yml"));
|
|
||||||
MessageConfig.checkConfig(new File(languages, "hu.yml"));
|
|
||||||
MessageConfig.checkConfig(new File(languages, "nl.yml"));
|
|
||||||
MessageConfig.checkConfig(new File(languages, "pl.yml"));
|
|
||||||
MessageConfig.checkConfig(new File(languages, "es.yml"));
|
|
||||||
MessageConfig.checkConfig(new File(languages, "ru.yml"));
|
|
||||||
MessageConfig.checkConfig(new File(languages, "fi.yml"));
|
|
||||||
// Here we are for #5
|
|
||||||
MessageConfig.checkConfig(new File(languages, "zh.yml"));
|
|
||||||
MessageConfig.checkConfig(new File(languages, "fr.yml"));
|
|
||||||
MessageConfig.checkConfig(new File(languages, PluginConfig.getLanguage() + ".yml"));
|
|
||||||
if (!dconfig.exists()) {
|
|
||||||
try {
|
|
||||||
dconfig.createNewFile();
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("Wasn't able to create DependenceConfig");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
new DependenceConfig();
|
|
||||||
}
|
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(config);
|
|
||||||
SettingsConfig.checkConfig();
|
|
||||||
File worlddir = new File(cfg.getString("worldfolder"));
|
|
||||||
if (!worlddir.exists()) {
|
|
||||||
worlddir.mkdirs();
|
|
||||||
}
|
|
||||||
GuiConfig.checkConfig(gui);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WorldSystem getInstance() {
|
|
||||||
return JavaPlugin.getPlugin(WorldSystem.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CreatorAdapter getAdapter() {
|
public CreatorAdapter getAdapter() {
|
||||||
return creator;
|
return creator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean is1_13() {
|
|
||||||
return is1_13Plus;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,41 +13,41 @@ import java.nio.channels.ReadableByteChannel;
|
|||||||
*/
|
*/
|
||||||
public class AutoUpdate implements Runnable {
|
public class AutoUpdate implements Runnable {
|
||||||
|
|
||||||
private final UpdateInformations ui;
|
private final UpdateInformations ui;
|
||||||
private final String jar;
|
private final String jar;
|
||||||
|
|
||||||
protected AutoUpdate(UpdateInformations ui, String jar) {
|
protected AutoUpdate(UpdateInformations ui, String jar) {
|
||||||
this.ui = ui;
|
this.ui = ui;
|
||||||
this.jar = jar;
|
this.jar = jar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
FileChannel out = null;
|
FileChannel out = null;
|
||||||
FileOutputStream outStream = null;
|
FileOutputStream outStream = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
ReadableByteChannel in = Channels
|
ReadableByteChannel in = Channels
|
||||||
.newChannel(new URL(ui.getURL()).openStream());
|
.newChannel(new URL(ui.getURL()).openStream());
|
||||||
outStream = new FileOutputStream(jar);
|
outStream = new FileOutputStream(jar);
|
||||||
out = outStream.getChannel();
|
out = outStream.getChannel();
|
||||||
out.transferFrom(in, 0, Long.MAX_VALUE);
|
out.transferFrom(in, 0, Long.MAX_VALUE);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
if (out != null)
|
if (out != null)
|
||||||
try {
|
try {
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (outStream != null) {
|
if (outStream != null) {
|
||||||
try {
|
try {
|
||||||
outStream.close();
|
outStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,107 +20,107 @@ import java.lang.reflect.Method;
|
|||||||
*/
|
*/
|
||||||
public class AutoUpdater implements Listener {
|
public class AutoUpdater implements Listener {
|
||||||
|
|
||||||
private boolean confirmed;
|
private static AutoUpdater instance;
|
||||||
private boolean confirmNeed;
|
private boolean confirmed;
|
||||||
private static AutoUpdater instance;
|
private boolean confirmNeed;
|
||||||
private AutoUpdate au;
|
private AutoUpdate au;
|
||||||
|
|
||||||
public static void startAsync() {
|
private AutoUpdater() {
|
||||||
Thread t = new Thread(() -> {
|
confirmNeed = PluginConfig.confirmNeed();
|
||||||
getInstance();
|
UpdateInformations ui = UpdateInformations.getInformations();
|
||||||
});
|
if (ui == null) {
|
||||||
t.setName("update-thread-worldsystem");
|
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server");
|
||||||
t.start();
|
return;
|
||||||
}
|
}
|
||||||
|
Plugin plugin = Bukkit.getPluginManager().getPlugin(ui.getPlugin());
|
||||||
|
if (plugin == null)
|
||||||
|
return;
|
||||||
|
String v = plugin.getDescription().getVersion();
|
||||||
|
if (!ui.getVersion().equals(plugin.getDescription().getVersion())) {
|
||||||
|
|
||||||
public static synchronized AutoUpdater getInstance() {
|
if (!ui.isSilent()) {
|
||||||
if (instance == null)
|
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found new version. Current: " + v
|
||||||
instance = new AutoUpdater();
|
+ ", Available: " + ui.getVersion());
|
||||||
return instance;
|
}
|
||||||
}
|
// Get jar file
|
||||||
|
Method getFileMethod;
|
||||||
|
try {
|
||||||
|
getFileMethod = JavaPlugin.class.getDeclaredMethod("getFile");
|
||||||
|
} catch (NoSuchMethodException | SecurityException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getFileMethod.setAccessible(true);
|
||||||
|
File file;
|
||||||
|
|
||||||
private AutoUpdater() {
|
try {
|
||||||
confirmNeed = PluginConfig.confirmNeed();
|
file = (File) getFileMethod.invoke(plugin);
|
||||||
UpdateInformations ui = UpdateInformations.getInformations();
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||||
if (ui == null) {
|
e.printStackTrace();
|
||||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server");
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
Plugin plugin = Bukkit.getPluginManager().getPlugin(ui.getPlugin());
|
|
||||||
if (plugin == null)
|
|
||||||
return;
|
|
||||||
String v = plugin.getDescription().getVersion();
|
|
||||||
if (!ui.getVersion().equals(plugin.getDescription().getVersion())) {
|
|
||||||
|
|
||||||
if (!ui.isSilent()) {
|
getFileMethod.setAccessible(false);
|
||||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found new version. Current: " + v
|
|
||||||
+ ", Available: " + ui.getVersion());
|
|
||||||
}
|
|
||||||
// Get jar file
|
|
||||||
Method getFileMethod;
|
|
||||||
try {
|
|
||||||
getFileMethod = JavaPlugin.class.getDeclaredMethod("getFile");
|
|
||||||
} catch (NoSuchMethodException | SecurityException e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getFileMethod.setAccessible(true);
|
|
||||||
File file;
|
|
||||||
|
|
||||||
try {
|
String jar = file.getAbsolutePath();
|
||||||
file = (File) getFileMethod.invoke(plugin);
|
au = new AutoUpdate(ui, jar);
|
||||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
if (ui.isSilent() || !confirmNeed) {
|
||||||
e.printStackTrace();
|
Runtime.getRuntime().addShutdownHook(new Thread(au));
|
||||||
return;
|
if (!ui.isSilent())
|
||||||
}
|
Bukkit.getConsoleSender().sendMessage(
|
||||||
|
PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes");
|
||||||
|
confirmed = true;
|
||||||
|
} else {
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
p.sendMessage(
|
||||||
|
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
||||||
|
p.sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
||||||
|
}
|
||||||
|
Bukkit.getConsoleSender().sendMessage(
|
||||||
|
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
||||||
|
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
confirmNeed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getFileMethod.setAccessible(false);
|
public static void startAsync() {
|
||||||
|
Thread t = new Thread(() -> {
|
||||||
|
getInstance();
|
||||||
|
});
|
||||||
|
t.setName("update-thread-worldsystem");
|
||||||
|
t.start();
|
||||||
|
}
|
||||||
|
|
||||||
String jar = file.getAbsolutePath();
|
public static synchronized AutoUpdater getInstance() {
|
||||||
au = new AutoUpdate(ui, jar);
|
if (instance == null)
|
||||||
if (ui.isSilent() || !confirmNeed) {
|
instance = new AutoUpdater();
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(au));
|
return instance;
|
||||||
if (!ui.isSilent())
|
}
|
||||||
Bukkit.getConsoleSender().sendMessage(
|
|
||||||
PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes");
|
|
||||||
confirmed = true;
|
|
||||||
} else {
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
p.sendMessage(
|
|
||||||
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
|
||||||
p.sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
|
||||||
}
|
|
||||||
Bukkit.getConsoleSender().sendMessage(
|
|
||||||
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
|
||||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
confirmNeed = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void on(PlayerJoinEvent e) {
|
public void on(PlayerJoinEvent e) {
|
||||||
if (e.getPlayer().hasPermission("ws.confirm")) {
|
if (e.getPlayer().hasPermission("ws.confirm")) {
|
||||||
e.getPlayer().sendMessage(
|
e.getPlayer().sendMessage(
|
||||||
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
|
||||||
e.getPlayer().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
e.getPlayer().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean confirm() {
|
public boolean confirm() {
|
||||||
if (confirmNeed && !confirmed) {
|
if (confirmNeed && !confirmed) {
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(au));
|
Runtime.getRuntime().addShutdownHook(new Thread(au));
|
||||||
confirmed = true;
|
confirmed = true;
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean confirmed() {
|
public boolean confirmed() {
|
||||||
return confirmed;
|
return confirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,13 @@ public class UpdateInformations {
|
|||||||
private final String version, url, plugin;
|
private final String version, url, plugin;
|
||||||
private final boolean silent;
|
private final boolean silent;
|
||||||
|
|
||||||
|
public UpdateInformations(String version, String url, String plugin, boolean silent) {
|
||||||
|
this.version = version;
|
||||||
|
this.url = url;
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.silent = silent;
|
||||||
|
}
|
||||||
|
|
||||||
protected static synchronized UpdateInformations getInformations() {
|
protected static synchronized UpdateInformations getInformations() {
|
||||||
String json = callURL("https://zendilu.net/butzlabben/worldsystem/info.php?version=" + WorldSystem.getInstance().getDescription().getVersion());
|
String json = callURL("https://zendilu.net/butzlabben/worldsystem/info.php?version=" + WorldSystem.getInstance().getDescription().getVersion());
|
||||||
Gson gson = new GsonBuilder().create();
|
Gson gson = new GsonBuilder().create();
|
||||||
@ -73,11 +80,4 @@ public class UpdateInformations {
|
|||||||
public boolean isSilent() {
|
public boolean isSilent() {
|
||||||
return silent;
|
return silent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpdateInformations(String version, String url, String plugin, boolean silent) {
|
|
||||||
this.version = version;
|
|
||||||
this.url = url;
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.silent = silent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class WorldSettingsCommands {
|
|||||||
|
|
||||||
private final ArrayList<Player> toConfirm = new ArrayList<>();
|
private final ArrayList<Player> toConfirm = new ArrayList<>();
|
||||||
|
|
||||||
@Command(name="ws.reset", inGameOnly = true, usage = "/ws reset [confirm]")
|
@Command(name = "ws.reset", inGameOnly = true, usage = "/ws reset [confirm]")
|
||||||
public void resetCommand(CommandArgs args) {
|
public void resetCommand(CommandArgs args) {
|
||||||
Player p = args.getSender(Player.class);
|
Player p = args.getSender(Player.class);
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ public class WorldSettingsCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!p.hasPermission("ws.sethome")) {
|
if (!p.hasPermission("ws.sethome")) {
|
||||||
p.sendMessage(MessageConfig.getNoPermission());
|
p.sendMessage(MessageConfig.getNoPermission());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -196,11 +196,15 @@ public class WorldSettingsCommands {
|
|||||||
|
|
||||||
private void createWorld(Player p, String worldname, File f, WorldTemplate template, SystemWorld sw) {
|
private void createWorld(Player p, String worldname, File f, WorldTemplate template, SystemWorld sw) {
|
||||||
|
|
||||||
File[] files = f.listFiles();
|
if (f != null) {
|
||||||
for (File file : files) {
|
File[] files = f.listFiles();
|
||||||
if (file.getName().equals("worldconfig.yml"))
|
if (files != null) {
|
||||||
continue;
|
for (File file : files) {
|
||||||
FileUtils.deleteQuietly(file);
|
if (file.getName().equals("worldconfig.yml"))
|
||||||
|
continue;
|
||||||
|
FileUtils.deleteQuietly(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -11,149 +11,149 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class DependenceConfig {
|
public class DependenceConfig {
|
||||||
|
|
||||||
private OfflinePlayer op;
|
private OfflinePlayer op;
|
||||||
|
|
||||||
public DependenceConfig() {
|
public DependenceConfig() {
|
||||||
setConfig();
|
setConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public DependenceConfig(String s) {
|
public DependenceConfig(String s) {
|
||||||
OfflinePlayer op = null;
|
OfflinePlayer op = null;
|
||||||
try {
|
try {
|
||||||
op = Bukkit.getOfflinePlayer(UUID.fromString(s));
|
op = Bukkit.getOfflinePlayer(UUID.fromString(s));
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
if (op == null) {
|
if (op == null) {
|
||||||
op = Bukkit.getOfflinePlayer(s);
|
op = Bukkit.getOfflinePlayer(s);
|
||||||
}
|
}
|
||||||
this.op = op;
|
this.op = op;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setConfig() {
|
public DependenceConfig(Player p) {
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
this.op = p;
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
refreshName();
|
||||||
cfg.set("HighestID", -1);
|
}
|
||||||
try {
|
|
||||||
cfg.save(dconfig);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DependenceConfig(Player p) {
|
public DependenceConfig(OfflinePlayer p) {
|
||||||
this.op = p;
|
this.op = p;
|
||||||
refreshName();
|
refreshName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DependenceConfig(OfflinePlayer p) {
|
public static int getHighestID() {
|
||||||
this.op = p;
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
refreshName();
|
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
}
|
return dcfg.getInt("HighestID");
|
||||||
|
}
|
||||||
|
|
||||||
public void refreshName() {
|
public static void checkWorlds() {
|
||||||
if (hasWorld()) {
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
|
||||||
String uuid = this.op.getUniqueId().toString();
|
|
||||||
cfg.set("Dependences." + uuid + ".ActualName", op.getName());
|
|
||||||
try {
|
|
||||||
cfg.save(dconfig);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createNewEntry() {
|
long deleteTime = 1000 * 60 * 60 * 24 * PluginConfig.deleteAfter();
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
long now = System.currentTimeMillis();
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
for (String s : cfg.getConfigurationSection("Dependences").getKeys(false)) {
|
||||||
String uuid = this.op.getUniqueId().toString();
|
if (!cfg.isLong("Dependences." + s + ".last_loaded") && !cfg.isInt("Dependences." + s + ".last_loaded"))
|
||||||
int id = cfg.getInt("HighestID");
|
continue;
|
||||||
id++;
|
long lastLoaded = cfg.getLong("Dependences." + s + ".last_loaded");
|
||||||
cfg.set("HighestID", id);
|
long diff = now - lastLoaded;
|
||||||
cfg.set("Dependences." + uuid + ".ID", id);
|
if (diff > deleteTime) {
|
||||||
cfg.set("Dependences." + uuid + ".ActualName", op.getName());
|
Bukkit.getConsoleSender().sendMessage(
|
||||||
try {
|
PluginConfig.getPrefix() + "World of " + s + " was not loaded for too long. Deleting!");
|
||||||
cfg.save(dconfig);
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ws delete " + s);
|
||||||
} catch (IOException e) {
|
}
|
||||||
e.printStackTrace();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasWorld() {
|
private void setConfig() {
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
String uuid = op.getUniqueId().toString();
|
cfg.set("HighestID", -1);
|
||||||
//Fix for #40
|
try {
|
||||||
|
cfg.save(dconfig);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshName() {
|
||||||
|
if (hasWorld()) {
|
||||||
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
|
String uuid = this.op.getUniqueId().toString();
|
||||||
|
cfg.set("Dependences." + uuid + ".ActualName", op.getName());
|
||||||
|
try {
|
||||||
|
cfg.save(dconfig);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createNewEntry() {
|
||||||
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
|
String uuid = this.op.getUniqueId().toString();
|
||||||
|
int id = cfg.getInt("HighestID");
|
||||||
|
id++;
|
||||||
|
cfg.set("HighestID", id);
|
||||||
|
cfg.set("Dependences." + uuid + ".ID", id);
|
||||||
|
cfg.set("Dependences." + uuid + ".ActualName", op.getName());
|
||||||
|
try {
|
||||||
|
cfg.save(dconfig);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasWorld() {
|
||||||
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
|
String uuid = op.getUniqueId().toString();
|
||||||
|
//Fix for #40
|
||||||
return cfg.isInt("Dependences." + uuid + ".ID");
|
return cfg.isInt("Dependences." + uuid + ".ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWorldname() {
|
public String getWorldname() {
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
String uuid = op.getUniqueId().toString();
|
String uuid = op.getUniqueId().toString();
|
||||||
int id = dcfg.getInt("Dependences." + uuid + ".ID");
|
int id = dcfg.getInt("Dependences." + uuid + ".ID");
|
||||||
return "ID" + id + "-" + uuid;
|
return "ID" + id + "-" + uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWorldNamebyOfflinePlayer() {
|
public String getWorldNamebyOfflinePlayer() {
|
||||||
String name;
|
String name;
|
||||||
String uuid = op.getUniqueId().toString();
|
String uuid = op.getUniqueId().toString();
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
if (cfg.getString("Dependences." + uuid + ".ActualName") == null) {
|
if (cfg.getString("Dependences." + uuid + ".ActualName") == null) {
|
||||||
name = "n";
|
name = "n";
|
||||||
} else {
|
} else {
|
||||||
name = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + "-" + uuid;
|
name = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + "-" + uuid;
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastLoaded() {
|
public void setLastLoaded() {
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
String uuid = op.getUniqueId().toString();
|
String uuid = op.getUniqueId().toString();
|
||||||
cfg.set("Dependences." + uuid + ".last_loaded", System.currentTimeMillis());
|
cfg.set("Dependences." + uuid + ".last_loaded", System.currentTimeMillis());
|
||||||
try {
|
try {
|
||||||
cfg.save(dconfig);
|
cfg.save(dconfig);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getHighestID() {
|
public int getID() {
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
return dcfg.getInt("HighestID");
|
return dcfg.getInt("Dependences." + op.getUniqueId().toString() + ".ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getID() {
|
public OfflinePlayer getOwner() {
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
return op;
|
||||||
YamlConfiguration dcfg = YamlConfiguration.loadConfiguration(dconfig);
|
}
|
||||||
return dcfg.getInt("Dependences." + op.getUniqueId().toString() + ".ID");
|
|
||||||
}
|
|
||||||
|
|
||||||
public OfflinePlayer getOwner() {
|
|
||||||
return op;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void checkWorlds() {
|
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
|
||||||
|
|
||||||
long deleteTime = 1000 * 60 * 60 * 24 * PluginConfig.deleteAfter();
|
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
for (String s : cfg.getConfigurationSection("Dependences").getKeys(false)) {
|
|
||||||
if (!cfg.isLong("Dependences." + s + ".last_loaded") && !cfg.isInt("Dependences." + s + ".last_loaded"))
|
|
||||||
continue;
|
|
||||||
long lastLoaded = cfg.getLong("Dependences." + s + ".last_loaded");
|
|
||||||
long diff = now - lastLoaded;
|
|
||||||
if (diff > deleteTime) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(
|
|
||||||
PluginConfig.getPrefix() + "World of " + s + " was not loaded for too long. Deleting!");
|
|
||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ws delete " + s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,46 +8,46 @@ import java.io.File;
|
|||||||
|
|
||||||
public class Entry {
|
public class Entry {
|
||||||
|
|
||||||
private final OfflinePlayer op;
|
private final OfflinePlayer op;
|
||||||
private int id;
|
private final String worldname;
|
||||||
private final String worldname;
|
private int id;
|
||||||
|
|
||||||
public static int entrys() {
|
|
||||||
int entrys = 0;
|
|
||||||
for(OfflinePlayer op : Bukkit.getOfflinePlayers()) {
|
|
||||||
Entry e = new Entry(op);
|
|
||||||
if(e.hasWorld())
|
|
||||||
++entrys;
|
|
||||||
}
|
|
||||||
return entrys;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected OfflinePlayer getOfflinePlayer() {
|
|
||||||
return op;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int getID() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getWorldname() {
|
|
||||||
return worldname;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean hasWorld() {
|
protected Entry(OfflinePlayer op) {
|
||||||
|
String uuid = op.getUniqueId().toString();
|
||||||
|
this.op = op;
|
||||||
|
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
||||||
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
||||||
|
if (cfg.getString("Dependences." + uuid + ".ActualName") == null) {
|
||||||
|
worldname = "n";
|
||||||
|
} else {
|
||||||
|
worldname = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + " " + uuid;
|
||||||
|
id = cfg.getInt("Dependences." + uuid + ".ID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int entrys() {
|
||||||
|
int entrys = 0;
|
||||||
|
for (OfflinePlayer op : Bukkit.getOfflinePlayers()) {
|
||||||
|
Entry e = new Entry(op);
|
||||||
|
if (e.hasWorld())
|
||||||
|
++entrys;
|
||||||
|
}
|
||||||
|
return entrys;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected OfflinePlayer getOfflinePlayer() {
|
||||||
|
return op;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getWorldname() {
|
||||||
|
return worldname;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean hasWorld() {
|
||||||
return !"n".equals(worldname);
|
return !"n".equals(worldname);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Entry(OfflinePlayer op) {
|
|
||||||
String uuid = op.getUniqueId().toString();
|
|
||||||
this.op = op;
|
|
||||||
File dconfig = new File("plugins//WorldSystem//dependence.yml");
|
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
|
|
||||||
if (cfg.getString("Dependences." + uuid + ".ActualName") == null) {
|
|
||||||
worldname = "n";
|
|
||||||
} else {
|
|
||||||
worldname = "ID" + cfg.getInt("Dependences." + uuid + ".ID") + " " + uuid;
|
|
||||||
id = cfg.getInt("Dependences." + uuid + ".ID");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -17,131 +17,131 @@ import java.util.List;
|
|||||||
|
|
||||||
public class GuiConfig {
|
public class GuiConfig {
|
||||||
|
|
||||||
private GuiConfig() {
|
private static File file;
|
||||||
}
|
|
||||||
|
|
||||||
private static File file;
|
private GuiConfig() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void checkConfig(File f) {
|
public static void checkConfig(File f) {
|
||||||
file = f;
|
file = f;
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
try {
|
try {
|
||||||
String guiFileResource;
|
String guiFileResource;
|
||||||
if (WorldSystem.is1_13()) {
|
if (WorldSystem.is1_13()) {
|
||||||
guiFileResource = "1_13_gui.yml";
|
guiFileResource = "1_13_gui.yml";
|
||||||
} else {
|
} else {
|
||||||
guiFileResource = "old_gui.yml";
|
guiFileResource = "old_gui.yml";
|
||||||
}
|
}
|
||||||
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(guiFileResource);
|
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(guiFileResource);
|
||||||
Files.copy(in, file.toPath());
|
Files.copy(in, file.toPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Wasn't able to create Config");
|
System.err.println("Wasn't able to create Config");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OrcItem.enabled = getEnabled();
|
OrcItem.enabled = getEnabled();
|
||||||
OrcItem.disabled = getDisabled();
|
OrcItem.disabled = getDisabled();
|
||||||
OrcItem.coming_soon = getComingSoon();
|
OrcItem.coming_soon = getComingSoon();
|
||||||
OrcItem.back = getBack();
|
OrcItem.back = getBack();
|
||||||
OrcItem.fill = getFill();
|
OrcItem.fill = getFill();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static YamlConfiguration getConfig() {
|
public static YamlConfiguration getConfig() {
|
||||||
try {
|
try {
|
||||||
return YamlConfiguration
|
return YamlConfiguration
|
||||||
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSlot(String path) {
|
public static int getSlot(String path) {
|
||||||
YamlConfiguration cfg = getConfig();
|
YamlConfiguration cfg = getConfig();
|
||||||
return (cfg.getInt(path + ".slot.row") - 1) * 9 + cfg.getInt(path + ".slot.col") - 1;
|
return (cfg.getInt(path + ".slot.row") - 1) * 9 + cfg.getInt(path + ".slot.col") - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getState(String path) {
|
public static int getState(String path) {
|
||||||
YamlConfiguration cfg = getConfig();
|
YamlConfiguration cfg = getConfig();
|
||||||
return (cfg.getInt(path + ".state.row") - 1) * 9 + cfg.getInt(path + ".state.col") - 1;
|
return (cfg.getInt(path + ".state.row") - 1) * 9 + cfg.getInt(path + ".state.col") - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEnabled(String path) {
|
public static boolean isEnabled(String path) {
|
||||||
return getConfig().getBoolean(path + ".enabled", true);
|
return getConfig().getBoolean(path + ".enabled", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getRows(String path) {
|
public static int getRows(String path) {
|
||||||
return getConfig().getInt(path + ".rows", 1);
|
return getConfig().getInt(path + ".rows", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDisplay(FileConfiguration cfg, String path) {
|
public static String getDisplay(FileConfiguration cfg, String path) {
|
||||||
return ChatColor.translateAlternateColorCodes('&', cfg.getString(path + ".display"));
|
return ChatColor.translateAlternateColorCodes('&', cfg.getString(path + ".display"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<String> getLore(FileConfiguration cfg, String path) {
|
public static ArrayList<String> getLore(FileConfiguration cfg, String path) {
|
||||||
List<String> list = cfg.getStringList(path + ".lore");
|
List<String> list = cfg.getStringList(path + ".lore");
|
||||||
ArrayList<String> colored = new ArrayList<>(list.size());
|
ArrayList<String> colored = new ArrayList<>(list.size());
|
||||||
for (String s : list) {
|
for (String s : list) {
|
||||||
colored.add(ChatColor.translateAlternateColorCodes('&', s));
|
colored.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||||
}
|
}
|
||||||
return colored;
|
return colored;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte getData(FileConfiguration cfg, String path) {
|
public static byte getData(FileConfiguration cfg, String path) {
|
||||||
return (byte) cfg.getInt(path + ".data", 0);
|
return (byte) cfg.getInt(path + ".data", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTitle(FileConfiguration cfg, String path) {
|
|
||||||
return cfg.getString(path + ".title");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Material getMaterial(FileConfiguration cfg, String path) {
|
public static String getTitle(FileConfiguration cfg, String path) {
|
||||||
try {
|
return cfg.getString(path + ".title");
|
||||||
return Material.valueOf(cfg.getString(path + ".material").toUpperCase());
|
}
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cUnknown material: " + path);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static OrcItem getItem(String path) {
|
public static Material getMaterial(FileConfiguration cfg, String path) {
|
||||||
YamlConfiguration cfg = getConfig();
|
try {
|
||||||
try {
|
return Material.valueOf(cfg.getString(path + ".material").toUpperCase());
|
||||||
return new OrcItem(getMaterial(cfg, path), getData(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
|
} catch (IllegalArgumentException ex) {
|
||||||
} catch (Exception ignored) {
|
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cUnknown material: " + path);
|
||||||
}
|
return null;
|
||||||
try {
|
}
|
||||||
return new OrcItem(getMaterial(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
|
}
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
return OrcItem.error.clone().setDisplay("§c" + path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static OrcItem getEnabled() {
|
public static OrcItem getItem(String path) {
|
||||||
return getItem("options.enabled");
|
YamlConfiguration cfg = getConfig();
|
||||||
}
|
try {
|
||||||
|
return new OrcItem(getMaterial(cfg, path), getData(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return new OrcItem(getMaterial(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
return OrcItem.error.clone().setDisplay("§c" + path);
|
||||||
|
}
|
||||||
|
|
||||||
public static OrcItem getDisabled() {
|
public static OrcItem getEnabled() {
|
||||||
return getItem("options.disabled");
|
return getItem("options.enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OrcItem getComingSoon() {
|
public static OrcItem getDisabled() {
|
||||||
return getItem("options.coming_soon");
|
return getItem("options.disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static OrcItem getBack() {
|
|
||||||
return getItem("options.back");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static OrcItem getFill() {
|
|
||||||
return getItem("options.fill");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isFill(String path) {
|
|
||||||
return getConfig().getBoolean(path + ".fill");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Material getSkullItem() {
|
public static OrcItem getComingSoon() {
|
||||||
return getMaterial(getConfig(), "options.players.playerhead");
|
return getItem("options.coming_soon");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static OrcItem getBack() {
|
||||||
|
return getItem("options.back");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static OrcItem getFill() {
|
||||||
|
return getItem("options.fill");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFill(String path) {
|
||||||
|
return getConfig().getBoolean(path + ".fill");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Material getSkullItem() {
|
||||||
|
return getMaterial(getConfig(), "options.players.playerhead");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,8 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class MessageConfig {
|
public class MessageConfig {
|
||||||
|
|
||||||
private MessageConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final List<String> defaultCmdHelp = new ArrayList<>(20);
|
private static final List<String> defaultCmdHelp = new ArrayList<>(20);
|
||||||
|
private static File file;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
defaultCmdHelp.add("/ws get §8- §7Will give you a World");
|
defaultCmdHelp.add("/ws get §8- §7Will give you a World");
|
||||||
@ -35,7 +33,8 @@ public class MessageConfig {
|
|||||||
defaultCmdHelp.add("/ws reset §8- §7Will reset your World");
|
defaultCmdHelp.add("/ws reset §8- §7Will reset your World");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File file;
|
private MessageConfig() {
|
||||||
|
}
|
||||||
// private static HashMap<String, File> languages = new HashMap<>();
|
// private static HashMap<String, File> languages = new HashMap<>();
|
||||||
|
|
||||||
public static void checkConfig(File f) {
|
public static void checkConfig(File f) {
|
||||||
|
@ -20,13 +20,12 @@ import java.util.Date;
|
|||||||
|
|
||||||
public class PluginConfig {
|
public class PluginConfig {
|
||||||
|
|
||||||
private PluginConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private static File file;
|
|
||||||
|
|
||||||
private final static GameMode[] gameModes = new GameMode[]{GameMode.SURVIVAL, GameMode.CREATIVE,
|
private final static GameMode[] gameModes = new GameMode[]{GameMode.SURVIVAL, GameMode.CREATIVE,
|
||||||
GameMode.ADVENTURE, GameMode.SPECTATOR};
|
GameMode.ADVENTURE, GameMode.SPECTATOR};
|
||||||
|
private static File file;
|
||||||
|
|
||||||
|
private PluginConfig() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void checkConfig(File f) {
|
public static void checkConfig(File f) {
|
||||||
file = f;
|
file = f;
|
||||||
|
@ -19,171 +19,171 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class SettingsConfig {
|
public class SettingsConfig {
|
||||||
|
|
||||||
private static final HashMap<String, Long> borderSizes = new HashMap<>();
|
private static final HashMap<String, Long> borderSizes = new HashMap<>();
|
||||||
|
|
||||||
private static File file;
|
private static File file;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
private SettingsConfig() {
|
||||||
public static void editWorld(World w) {
|
}
|
||||||
YamlConfiguration cfg = getConfig();
|
|
||||||
|
|
||||||
SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
|
@SuppressWarnings("deprecation")
|
||||||
|
public static void editWorld(World w) {
|
||||||
|
YamlConfiguration cfg = getConfig();
|
||||||
|
|
||||||
boolean shouldChange = cfg.getBoolean("worldborder.should_change", false);
|
SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
|
||||||
if (shouldChange) {
|
|
||||||
long size = cfg.getLong("worldborder.normal", 1000);
|
|
||||||
if (sw != null && sw.isLoaded()) {
|
|
||||||
String worldname = w.getName();
|
|
||||||
UUID uuid = UUID.fromString(worldname.substring(worldname.length() - 36));
|
|
||||||
Player p = Bukkit.getPlayer(uuid);
|
|
||||||
if (p != null && p.isOnline()) {
|
|
||||||
for (String string : borderSizes.keySet()) {
|
|
||||||
if (p.hasPermission(string) && size < borderSizes.get(string)) {
|
|
||||||
size = borderSizes.get(string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
w.getWorldBorder().setSize(size);
|
boolean shouldChange = cfg.getBoolean("worldborder.should_change", false);
|
||||||
|
if (shouldChange) {
|
||||||
|
long size = cfg.getLong("worldborder.normal", 1000);
|
||||||
|
if (sw != null && sw.isLoaded()) {
|
||||||
|
String worldname = w.getName();
|
||||||
|
UUID uuid = UUID.fromString(worldname.substring(worldname.length() - 36));
|
||||||
|
Player p = Bukkit.getPlayer(uuid);
|
||||||
|
if (p != null && p.isOnline()) {
|
||||||
|
for (String string : borderSizes.keySet()) {
|
||||||
|
if (p.hasPermission(string) && size < borderSizes.get(string)) {
|
||||||
|
size = borderSizes.get(string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cfg.getBoolean("worldborder.center.as_spawn", true)) {
|
w.getWorldBorder().setSize(size);
|
||||||
if (PluginConfig.useWorldSpawn()) {
|
|
||||||
w.getWorldBorder().setCenter(PluginConfig.getWorldSpawn(w));
|
|
||||||
} else {
|
|
||||||
w.getWorldBorder().setCenter(w.getSpawnLocation());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Location loc = new Location(w, cfg.getDouble("worldborder.center.x", 0),
|
|
||||||
cfg.getDouble("worldborder.center.y", 20), cfg.getDouble("worldborder.center.z", 0));
|
|
||||||
w.getWorldBorder().setCenter(loc);
|
|
||||||
}
|
|
||||||
if (cfg.getBoolean("worldborder.center.as_home")) {
|
|
||||||
WorldConfig config = WorldConfig.getWorldConfig(w.getName());
|
|
||||||
if (config.getHome() != null)
|
|
||||||
w.getWorldBorder().setCenter(config.getHome());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fix for #17
|
if (cfg.getBoolean("worldborder.center.as_spawn", true)) {
|
||||||
String diff = cfg.getString("difficulty");
|
if (PluginConfig.useWorldSpawn()) {
|
||||||
try {
|
w.getWorldBorder().setCenter(PluginConfig.getWorldSpawn(w));
|
||||||
Difficulty difficulty = Difficulty.valueOf(diff.toUpperCase());
|
} else {
|
||||||
w.setDifficulty(difficulty);
|
w.getWorldBorder().setCenter(w.getSpawnLocation());
|
||||||
} catch (IllegalArgumentException e) {
|
}
|
||||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cUnknown difficulty \"" + diff + "\" in settings.yml");
|
} else {
|
||||||
}
|
Location loc = new Location(w, cfg.getDouble("worldborder.center.x", 0),
|
||||||
|
cfg.getDouble("worldborder.center.y", 20), cfg.getDouble("worldborder.center.z", 0));
|
||||||
|
w.getWorldBorder().setCenter(loc);
|
||||||
|
}
|
||||||
|
if (cfg.getBoolean("worldborder.center.as_home")) {
|
||||||
|
WorldConfig config = WorldConfig.getWorldConfig(w.getName());
|
||||||
|
if (config.getHome() != null)
|
||||||
|
w.getWorldBorder().setCenter(config.getHome());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (w.isGameRule("announceAdvancements"))
|
// Fix for #17
|
||||||
w.setGameRuleValue("announceAdvancements", cfg.getString("announceAdvancements"));
|
String diff = cfg.getString("difficulty");
|
||||||
|
try {
|
||||||
|
Difficulty difficulty = Difficulty.valueOf(diff.toUpperCase());
|
||||||
|
w.setDifficulty(difficulty);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cUnknown difficulty \"" + diff + "\" in settings.yml");
|
||||||
|
}
|
||||||
|
|
||||||
if (w.isGameRule("commandBlockOutput"))
|
if (w.isGameRule("announceAdvancements"))
|
||||||
w.setGameRuleValue("commandBlockOutput", cfg.getString("commandBlockOutput"));
|
w.setGameRuleValue("announceAdvancements", cfg.getString("announceAdvancements"));
|
||||||
|
|
||||||
if (w.isGameRule("disableElytraMovementCheck"))
|
if (w.isGameRule("commandBlockOutput"))
|
||||||
w.setGameRuleValue("disableElytraMovementCheck", cfg.getString("disableElytraMovementCheck"));
|
w.setGameRuleValue("commandBlockOutput", cfg.getString("commandBlockOutput"));
|
||||||
|
|
||||||
if (w.isGameRule("doDaylightCycle"))
|
if (w.isGameRule("disableElytraMovementCheck"))
|
||||||
w.setGameRuleValue("doDaylightCycle", cfg.getString("doDaylightCycle"));
|
w.setGameRuleValue("disableElytraMovementCheck", cfg.getString("disableElytraMovementCheck"));
|
||||||
|
|
||||||
if (w.isGameRule("doEntityDrops"))
|
if (w.isGameRule("doDaylightCycle"))
|
||||||
w.setGameRuleValue("doEntityDrops", cfg.getString("doEntityDrops"));
|
w.setGameRuleValue("doDaylightCycle", cfg.getString("doDaylightCycle"));
|
||||||
|
|
||||||
if (w.isGameRule("doFireTick"))
|
if (w.isGameRule("doEntityDrops"))
|
||||||
w.setGameRuleValue("doFireTick", cfg.getString("doFireTick"));
|
w.setGameRuleValue("doEntityDrops", cfg.getString("doEntityDrops"));
|
||||||
|
|
||||||
if (w.isGameRule("doLimitedCrafting"))
|
if (w.isGameRule("doFireTick"))
|
||||||
w.setGameRuleValue("doLimitedCrafting", cfg.getString("doLimitedCrafting"));
|
w.setGameRuleValue("doFireTick", cfg.getString("doFireTick"));
|
||||||
|
|
||||||
if (w.isGameRule("doMobLoot"))
|
if (w.isGameRule("doLimitedCrafting"))
|
||||||
w.setGameRuleValue("doMobLoot", cfg.getString("doMobLoot"));
|
w.setGameRuleValue("doLimitedCrafting", cfg.getString("doLimitedCrafting"));
|
||||||
|
|
||||||
if (w.isGameRule("doMobSpawning"))
|
if (w.isGameRule("doMobLoot"))
|
||||||
w.setGameRuleValue("doMobSpawning", cfg.getString("doMobSpawning"));
|
w.setGameRuleValue("doMobLoot", cfg.getString("doMobLoot"));
|
||||||
|
|
||||||
if (w.isGameRule("doTileDrops"))
|
if (w.isGameRule("doMobSpawning"))
|
||||||
w.setGameRuleValue("doTileDrops", cfg.getString("doTileDrops"));
|
w.setGameRuleValue("doMobSpawning", cfg.getString("doMobSpawning"));
|
||||||
|
|
||||||
if (w.isGameRule("doWeatherCycle"))
|
if (w.isGameRule("doTileDrops"))
|
||||||
w.setGameRuleValue("doWeatherCycle", cfg.getString("doWeatherCycle"));
|
w.setGameRuleValue("doTileDrops", cfg.getString("doTileDrops"));
|
||||||
|
|
||||||
if (w.isGameRule("gameLoopFunction"))
|
if (w.isGameRule("doWeatherCycle"))
|
||||||
w.setGameRuleValue("gameLoopFunction", cfg.getString("gameLoopFunction"));
|
w.setGameRuleValue("doWeatherCycle", cfg.getString("doWeatherCycle"));
|
||||||
|
|
||||||
if (w.isGameRule("keepInventory"))
|
if (w.isGameRule("gameLoopFunction"))
|
||||||
w.setGameRuleValue("keepInventory", cfg.getString("keepInventory"));
|
w.setGameRuleValue("gameLoopFunction", cfg.getString("gameLoopFunction"));
|
||||||
|
|
||||||
if (w.isGameRule("logAdminCommands"))
|
if (w.isGameRule("keepInventory"))
|
||||||
w.setGameRuleValue("logAdminCommands", cfg.getString("logAdminCommands"));
|
w.setGameRuleValue("keepInventory", cfg.getString("keepInventory"));
|
||||||
|
|
||||||
if (w.isGameRule("maxCommandChainLength"))
|
if (w.isGameRule("logAdminCommands"))
|
||||||
w.setGameRuleValue("maxCommandChainLength", cfg.getString("maxCommandChainLength"));
|
w.setGameRuleValue("logAdminCommands", cfg.getString("logAdminCommands"));
|
||||||
|
|
||||||
if (w.isGameRule("maxEntityCramming"))
|
if (w.isGameRule("maxCommandChainLength"))
|
||||||
w.setGameRuleValue("maxEntityCramming", cfg.getString("maxEntityCramming"));
|
w.setGameRuleValue("maxCommandChainLength", cfg.getString("maxCommandChainLength"));
|
||||||
|
|
||||||
if (w.isGameRule("mobGriefing"))
|
if (w.isGameRule("maxEntityCramming"))
|
||||||
w.setGameRuleValue("mobGriefing", cfg.getString("mobGriefing"));
|
w.setGameRuleValue("maxEntityCramming", cfg.getString("maxEntityCramming"));
|
||||||
|
|
||||||
if (w.isGameRule("naturalRegeneration"))
|
if (w.isGameRule("mobGriefing"))
|
||||||
w.setGameRuleValue("naturalRegeneration", cfg.getString("naturalRegeneration"));
|
w.setGameRuleValue("mobGriefing", cfg.getString("mobGriefing"));
|
||||||
|
|
||||||
if (w.isGameRule("randomTickSpeed"))
|
if (w.isGameRule("naturalRegeneration"))
|
||||||
w.setGameRuleValue("randomTickSpeed", cfg.getString("randomTickSpeed"));
|
w.setGameRuleValue("naturalRegeneration", cfg.getString("naturalRegeneration"));
|
||||||
|
|
||||||
if (w.isGameRule("reducedDebugInfo"))
|
if (w.isGameRule("randomTickSpeed"))
|
||||||
w.setGameRuleValue("reducedDebugInfo", cfg.getString("reducedDebugInfo"));
|
w.setGameRuleValue("randomTickSpeed", cfg.getString("randomTickSpeed"));
|
||||||
|
|
||||||
if (w.isGameRule("sendCommandFeedback"))
|
if (w.isGameRule("reducedDebugInfo"))
|
||||||
w.setGameRuleValue("sendCommandFeedback", cfg.getString("sendCommandFeedback"));
|
w.setGameRuleValue("reducedDebugInfo", cfg.getString("reducedDebugInfo"));
|
||||||
|
|
||||||
if (w.isGameRule("showDeathMessages"))
|
if (w.isGameRule("sendCommandFeedback"))
|
||||||
w.setGameRuleValue("showDeathMessages", cfg.getString("showDeathMessages"));
|
w.setGameRuleValue("sendCommandFeedback", cfg.getString("sendCommandFeedback"));
|
||||||
|
|
||||||
if (w.isGameRule("spawnRadius"))
|
if (w.isGameRule("showDeathMessages"))
|
||||||
w.setGameRuleValue("spawnRadius", cfg.getString("spawnRadius"));
|
w.setGameRuleValue("showDeathMessages", cfg.getString("showDeathMessages"));
|
||||||
|
|
||||||
if (w.isGameRule("spectatorsGenerateChunks"))
|
if (w.isGameRule("spawnRadius"))
|
||||||
w.setGameRuleValue("spectatorsGenerateChunks", cfg.getString("spectatorsGenerateChunks"));
|
w.setGameRuleValue("spawnRadius", cfg.getString("spawnRadius"));
|
||||||
}
|
|
||||||
|
|
||||||
private static YamlConfiguration getConfig() {
|
if (w.isGameRule("spectatorsGenerateChunks"))
|
||||||
try {
|
w.setGameRuleValue("spectatorsGenerateChunks", cfg.getString("spectatorsGenerateChunks"));
|
||||||
return YamlConfiguration
|
}
|
||||||
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void checkConfig() {
|
private static YamlConfiguration getConfig() {
|
||||||
File file = new File(WorldSystem.getInstance().getDataFolder(), "settings.yml");
|
try {
|
||||||
SettingsConfig.file = file;
|
return YamlConfiguration
|
||||||
if (!file.exists()) {
|
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||||
try {
|
} catch (FileNotFoundException e) {
|
||||||
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("settings.yml");
|
e.printStackTrace();
|
||||||
Files.copy(in, file.toPath());
|
}
|
||||||
} catch (IOException e) {
|
return null;
|
||||||
System.err.println("Wasn't able to create Config");
|
}
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
YamlConfiguration cfg = getConfig();
|
|
||||||
for (String s : cfg.getConfigurationSection("worldborder.ranks").getKeys(true)) {
|
|
||||||
if (cfg.isInt("worldborder.ranks." + s) || cfg.isLong("worldborder.ranks." + s))
|
|
||||||
borderSizes.put(s, cfg.getLong("worldborder.ranks." + s));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public static void checkConfig() {
|
||||||
* @return the commands specified in settings.yml on /ws get
|
File file = new File(WorldSystem.getInstance().getDataFolder(), "settings.yml");
|
||||||
*/
|
SettingsConfig.file = file;
|
||||||
public static List<String> getCommandsonGet() {
|
if (!file.exists()) {
|
||||||
YamlConfiguration cfg = getConfig();
|
try {
|
||||||
return cfg.getStringList("commands_on_get");
|
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("settings.yml");
|
||||||
}
|
Files.copy(in, file.toPath());
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Wasn't able to create Config");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
YamlConfiguration cfg = getConfig();
|
||||||
|
for (String s : cfg.getConfigurationSection("worldborder.ranks").getKeys(true)) {
|
||||||
|
if (cfg.isInt("worldborder.ranks." + s) || cfg.isLong("worldborder.ranks." + s))
|
||||||
|
borderSizes.put(s, cfg.getLong("worldborder.ranks." + s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private SettingsConfig() {
|
/**
|
||||||
}
|
* @return the commands specified in settings.yml on /ws get
|
||||||
|
*/
|
||||||
|
public static List<String> getCommandsonGet() {
|
||||||
|
YamlConfiguration cfg = getConfig();
|
||||||
|
return cfg.getStringList("commands_on_get");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,13 @@ public class WorldConfig {
|
|||||||
|
|
||||||
private Location home = null;
|
private Location home = null;
|
||||||
|
|
||||||
|
private WorldConfig(String worldname) {
|
||||||
|
if (!exists(worldname))
|
||||||
|
throw new IllegalArgumentException("WorldConfig doesn't exist");
|
||||||
|
owner = UUID.fromString(worldname.substring(worldname.length() - 36));
|
||||||
|
id = Integer.parseInt(worldname.split("-")[0].substring(2));
|
||||||
|
}
|
||||||
|
|
||||||
public static File getWorldFile(String worldname) {
|
public static File getWorldFile(String worldname) {
|
||||||
File worldconfig = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
|
File worldconfig = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
|
||||||
if (!worldconfig.exists()) {
|
if (!worldconfig.exists()) {
|
||||||
@ -71,13 +78,6 @@ public class WorldConfig {
|
|||||||
return instances.get(worldname).load();
|
return instances.get(worldname).load();
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorldConfig(String worldname) {
|
|
||||||
if (!exists(worldname))
|
|
||||||
throw new IllegalArgumentException("WorldConfig doesn't exist");
|
|
||||||
owner = UUID.fromString(worldname.substring(worldname.length() - 36));
|
|
||||||
id = Integer.parseInt(worldname.split("-")[0].substring(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void create(Player p, WorldTemplate template) {
|
public static void create(Player p, WorldTemplate template) {
|
||||||
DependenceConfig dc = new DependenceConfig(p);
|
DependenceConfig dc = new DependenceConfig(p);
|
||||||
String worldname = dc.getWorldname();
|
String worldname = dc.getWorldname();
|
||||||
@ -480,13 +480,6 @@ public class WorldConfig {
|
|||||||
return name != null;
|
return name != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param loc the new home of the world
|
|
||||||
*/
|
|
||||||
public void setHome(Location loc) {
|
|
||||||
home = loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the home of the world. If not set returns null
|
* @return the home of the world. If not set returns null
|
||||||
*/
|
*/
|
||||||
@ -497,6 +490,13 @@ public class WorldConfig {
|
|||||||
home.getPitch());
|
home.getPitch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param loc the new home of the world
|
||||||
|
*/
|
||||||
|
public void setHome(Location loc) {
|
||||||
|
home = loc;
|
||||||
|
}
|
||||||
|
|
||||||
public String getOwnerName() {
|
public String getOwnerName() {
|
||||||
return ownerName;
|
return ownerName;
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
package de.butzlabben.world.config;
|
package de.butzlabben.world.config;
|
||||||
|
|
||||||
public enum WorldPerm {
|
public enum WorldPerm {
|
||||||
|
|
||||||
MEMBER("ws.member"),
|
MEMBER("ws.member"),
|
||||||
GAMEMODE("ws.gamemode"), BUILD("ws.build"), TELEPORT("ws.teleport"),
|
GAMEMODE("ws.gamemode"), BUILD("ws.build"), TELEPORT("ws.teleport"),
|
||||||
EDITMEMBERS("ws.edit"), ADMINISTRATEMEMBERS, ADMINISTRATEWORLD, WORLDEDIT("ws.worldedit");
|
EDITMEMBERS("ws.edit"), ADMINISTRATEMEMBERS, ADMINISTRATEWORLD, WORLDEDIT("ws.worldedit");
|
||||||
|
|
||||||
private final String opPerm;
|
private final String opPerm;
|
||||||
|
|
||||||
WorldPerm() {
|
WorldPerm() {
|
||||||
this("ws.*");
|
this("ws.*");
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldPerm(String opPerm) {
|
WorldPerm(String opPerm) {
|
||||||
this.opPerm = opPerm;
|
this.opPerm = opPerm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOpPerm() {
|
public String getOpPerm() {
|
||||||
return opPerm;
|
return opPerm;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,47 +7,46 @@ import java.util.UUID;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Event for adding somebody to a world
|
* Event for adding somebody to a world
|
||||||
*
|
*
|
||||||
* @author Butzlabben
|
* @author Butzlabben
|
||||||
* @since 09.05.2018
|
* @since 09.05.2018
|
||||||
*/
|
*/
|
||||||
public class WorldAddmemberEvent extends WorldEvent {
|
public class WorldAddmemberEvent extends WorldEvent {
|
||||||
|
|
||||||
private final String worldname;
|
public final static HandlerList handlers = new HandlerList();
|
||||||
private final UUID uuid;
|
private final String worldname;
|
||||||
private final Player adder;
|
private final UUID uuid;
|
||||||
|
private final Player adder;
|
||||||
public WorldAddmemberEvent(UUID uuid, String worldname, Player adder) {
|
|
||||||
this.uuid = uuid;
|
|
||||||
this.worldname = worldname;
|
|
||||||
this.adder = adder;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return player who adds somebody
|
|
||||||
*/
|
|
||||||
public Player getAdding() {
|
|
||||||
return adder;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return UUID of player who gets added
|
|
||||||
*/
|
|
||||||
public UUID getUUID() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return worldname for which it happens
|
|
||||||
*/
|
|
||||||
public String getWorldname() {
|
|
||||||
return worldname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final static HandlerList handlers = new HandlerList();
|
public WorldAddmemberEvent(UUID uuid, String worldname, Player adder) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.worldname = worldname;
|
||||||
|
this.adder = adder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return player who adds somebody
|
||||||
|
*/
|
||||||
|
public Player getAdding() {
|
||||||
|
return adder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return UUID of player who gets added
|
||||||
|
*/
|
||||||
|
public UUID getUUID() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return worldname for which it happens
|
||||||
|
*/
|
||||||
|
public String getWorldname() {
|
||||||
|
return worldname;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,47 +7,46 @@ import org.bukkit.event.HandlerList;
|
|||||||
/**
|
/**
|
||||||
* Event if a SystemWorld gets created.
|
* Event if a SystemWorld gets created.
|
||||||
* Do mix up with the WorldCreateEvent from Bukkit
|
* Do mix up with the WorldCreateEvent from Bukkit
|
||||||
*
|
*
|
||||||
* @author Butzlabben
|
* @author Butzlabben
|
||||||
* @since 09.05.2018
|
* @since 09.05.2018
|
||||||
*/
|
*/
|
||||||
public class WorldCreateEvent extends WorldEvent {
|
public class WorldCreateEvent extends WorldEvent {
|
||||||
|
|
||||||
private final Player owner;
|
public final static HandlerList handlers = new HandlerList();
|
||||||
private WorldCreator worldCreator;
|
private final Player owner;
|
||||||
|
private WorldCreator worldCreator;
|
||||||
|
|
||||||
public WorldCreateEvent(Player owner, WorldCreator creator) {
|
public WorldCreateEvent(Player owner, WorldCreator creator) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.setWorldCreator(creator);
|
this.setWorldCreator(creator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public final static HandlerList getHandlerList() {
|
||||||
* @return owner of world that gets created
|
return handlers;
|
||||||
*/
|
}
|
||||||
public Player getOwner() {
|
|
||||||
return owner;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final static HandlerList handlers = new HandlerList();
|
/**
|
||||||
|
* @return owner of world that gets created
|
||||||
|
*/
|
||||||
|
public Player getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
public final static HandlerList getHandlerList() {
|
@Override
|
||||||
return handlers;
|
public final HandlerList getHandlers() {
|
||||||
}
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public final HandlerList getHandlers() {
|
* @return the worldcreator which will be used
|
||||||
return handlers;
|
*/
|
||||||
}
|
public WorldCreator getWorldCreator() {
|
||||||
|
return worldCreator;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public void setWorldCreator(WorldCreator worldCreator) {
|
||||||
* @return the worldcreator which will be used
|
this.worldCreator = worldCreator;
|
||||||
*/
|
}
|
||||||
public WorldCreator getWorldCreator() {
|
|
||||||
return worldCreator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWorldCreator(WorldCreator worldCreator) {
|
|
||||||
this.worldCreator = worldCreator;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,43 +6,42 @@ import org.bukkit.event.HandlerList;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Event if a systemworld gets deleted
|
* Event if a systemworld gets deleted
|
||||||
*
|
*
|
||||||
* @author Butzlabben
|
* @author Butzlabben
|
||||||
* @since 09.05.2018
|
* @since 09.05.2018
|
||||||
*/
|
*/
|
||||||
public class WorldDeleteEvent extends WorldEvent {
|
public class WorldDeleteEvent extends WorldEvent {
|
||||||
|
|
||||||
private final SystemWorld world;
|
public final static HandlerList handlers = new HandlerList();
|
||||||
private final CommandSender executor;
|
private final SystemWorld world;
|
||||||
|
private final CommandSender executor;
|
||||||
public WorldDeleteEvent(CommandSender executor, SystemWorld world) {
|
|
||||||
this.executor = executor;
|
public WorldDeleteEvent(CommandSender executor, SystemWorld world) {
|
||||||
this.world = world;
|
this.executor = executor;
|
||||||
}
|
this.world = world;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @return get the world which will be deleted
|
public static HandlerList getHandlerList() {
|
||||||
*/
|
return handlers;
|
||||||
public SystemWorld getWorld() {
|
}
|
||||||
return world;
|
|
||||||
}
|
/**
|
||||||
|
* @return get the world which will be deleted
|
||||||
/**
|
*/
|
||||||
* @return get the executor of the command
|
public SystemWorld getWorld() {
|
||||||
*/
|
return world;
|
||||||
public CommandSender getExecutor() {
|
}
|
||||||
return executor;
|
|
||||||
}
|
/**
|
||||||
|
* @return get the executor of the command
|
||||||
public final static HandlerList handlers = new HandlerList();
|
*/
|
||||||
|
public CommandSender getExecutor() {
|
||||||
public static HandlerList getHandlerList() {
|
return executor;
|
||||||
return handlers;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public final HandlerList getHandlers() {
|
||||||
public final HandlerList getHandlers() {
|
return handlers;
|
||||||
return handlers;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,23 +5,23 @@ import org.bukkit.event.Event;
|
|||||||
|
|
||||||
public abstract class WorldEvent extends Event implements Cancellable {
|
public abstract class WorldEvent extends Event implements Cancellable {
|
||||||
|
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public WorldEvent() {
|
public WorldEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldEvent(boolean cancel) {
|
public WorldEvent(boolean cancel) {
|
||||||
setCancelled(cancel);
|
setCancelled(cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancelled;
|
return cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCancelled(boolean cancel) {
|
public void setCancelled(boolean cancel) {
|
||||||
cancelled = cancel;
|
cancelled = cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,43 +6,42 @@ import org.bukkit.event.HandlerList;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Event for loading a world
|
* Event for loading a world
|
||||||
*
|
*
|
||||||
* @author Butzlabben
|
* @author Butzlabben
|
||||||
* @since 09.05.2018
|
* @since 09.05.2018
|
||||||
*/
|
*/
|
||||||
public class WorldLoadEvent extends WorldEvent {
|
public class WorldLoadEvent extends WorldEvent {
|
||||||
|
|
||||||
private final Player owner;
|
public final static HandlerList handlers = new HandlerList();
|
||||||
private final SystemWorld world;
|
private final Player owner;
|
||||||
|
private final SystemWorld world;
|
||||||
|
|
||||||
public WorldLoadEvent(Player owner, SystemWorld systemWorld) {
|
public WorldLoadEvent(Player owner, SystemWorld systemWorld) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.world = systemWorld;
|
this.world = systemWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static HandlerList getHandlerList() {
|
||||||
* @return get the world which will be loaded
|
return handlers;
|
||||||
*/
|
}
|
||||||
public SystemWorld getWorld() {
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return get person which intiziated the loading
|
* @return get the world which will be loaded
|
||||||
*/
|
*/
|
||||||
public Player getOwner() {
|
public SystemWorld getWorld() {
|
||||||
return owner;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static HandlerList handlers = new HandlerList();
|
/**
|
||||||
|
* @return get person which intiziated the loading
|
||||||
|
*/
|
||||||
|
public Player getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
@Override
|
||||||
return handlers;
|
public final HandlerList getHandlers() {
|
||||||
}
|
return handlers;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public final HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,42 +11,40 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public class WorldRemovememberEvent extends WorldEvent {
|
public class WorldRemovememberEvent extends WorldEvent {
|
||||||
|
|
||||||
private final String worldname;
|
public final static HandlerList handlers = new HandlerList();
|
||||||
private final UUID uuid;
|
private final String worldname;
|
||||||
private final Player remover;
|
private final UUID uuid;
|
||||||
|
private final Player remover;
|
||||||
public WorldRemovememberEvent(UUID uuid, String worldname, Player remover) {
|
|
||||||
this.uuid = uuid;
|
|
||||||
this.worldname = worldname;
|
|
||||||
this.remover = remover;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return player who removes somebody
|
|
||||||
*/
|
|
||||||
public Player getRemoving() {
|
|
||||||
return remover;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return uuid of player who gets removed
|
|
||||||
*/
|
|
||||||
public UUID getUUID() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return worldname for which it happens
|
|
||||||
*/
|
|
||||||
public String getWorldname() {
|
|
||||||
return worldname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public WorldRemovememberEvent(UUID uuid, String worldname, Player remover) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.worldname = worldname;
|
||||||
|
this.remover = remover;
|
||||||
|
}
|
||||||
|
|
||||||
public final static HandlerList handlers = new HandlerList();
|
/**
|
||||||
|
* @return player who removes somebody
|
||||||
|
*/
|
||||||
|
public Player getRemoving() {
|
||||||
|
return remover;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return uuid of player who gets removed
|
||||||
|
*/
|
||||||
|
public UUID getUUID() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return worldname for which it happens
|
||||||
|
*/
|
||||||
|
public String getWorldname() {
|
||||||
|
return worldname;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,44 +6,41 @@ import org.bukkit.event.HandlerList;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Event when a world gets reset
|
* Event when a world gets reset
|
||||||
*
|
*
|
||||||
* @author Butzlabben
|
* @author Butzlabben
|
||||||
* @since 09.05.2018
|
* @since 09.05.2018
|
||||||
*/
|
*/
|
||||||
public class WorldResetEvent extends WorldEvent {
|
public class WorldResetEvent extends WorldEvent {
|
||||||
|
|
||||||
private final SystemWorld world;
|
public final static HandlerList handlers = new HandlerList();
|
||||||
private final CommandSender executor;
|
private final SystemWorld world;
|
||||||
|
private final CommandSender executor;
|
||||||
public WorldResetEvent(CommandSender executor, SystemWorld world) {
|
|
||||||
this.executor = executor;
|
public WorldResetEvent(CommandSender executor, SystemWorld world) {
|
||||||
this.world = world;
|
this.executor = executor;
|
||||||
}
|
this.world = world;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @return world which gets reset
|
public static HandlerList getHandlerList() {
|
||||||
*/
|
return handlers;
|
||||||
public SystemWorld getWorld() {
|
}
|
||||||
return world;
|
|
||||||
}
|
/**
|
||||||
|
* @return world which gets reset
|
||||||
/**
|
*/
|
||||||
* @return Executor of the command
|
public SystemWorld getWorld() {
|
||||||
*/
|
return world;
|
||||||
public CommandSender getExecutor() {
|
}
|
||||||
return executor;
|
|
||||||
}
|
/**
|
||||||
|
* @return Executor of the command
|
||||||
|
*/
|
||||||
|
public CommandSender getExecutor() {
|
||||||
public final static HandlerList handlers = new HandlerList();
|
return executor;
|
||||||
|
}
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
@Override
|
||||||
}
|
public final HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
@Override
|
}
|
||||||
public final HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,55 +9,52 @@ import org.bukkit.event.HandlerList;
|
|||||||
* @since 09.05.2018
|
* @since 09.05.2018
|
||||||
*/
|
*/
|
||||||
public class WorldToggleFireEvent extends WorldEvent {
|
public class WorldToggleFireEvent extends WorldEvent {
|
||||||
|
|
||||||
private final SystemWorld world;
|
public final static HandlerList handlers = new HandlerList();
|
||||||
private final CommandSender executor;
|
private final SystemWorld world;
|
||||||
private boolean value;
|
private final CommandSender executor;
|
||||||
|
private boolean value;
|
||||||
public WorldToggleFireEvent(CommandSender executor, SystemWorld world, boolean value) {
|
|
||||||
this.executor = executor;
|
public WorldToggleFireEvent(CommandSender executor, SystemWorld world, boolean value) {
|
||||||
this.world = world;
|
this.executor = executor;
|
||||||
this.value = value;
|
this.world = world;
|
||||||
}
|
this.value = value;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @return if fire now gets enabled or disabled
|
public static HandlerList getHandlerList() {
|
||||||
*/
|
return handlers;
|
||||||
public boolean getValue() {
|
}
|
||||||
return value;
|
|
||||||
}
|
/**
|
||||||
|
* @return if fire now gets enabled or disabled
|
||||||
/**
|
*/
|
||||||
* @param val if fire should be enabled or disabled
|
public boolean getValue() {
|
||||||
*/
|
return value;
|
||||||
public void setValue(boolean val) {
|
}
|
||||||
value = val;
|
|
||||||
}
|
/**
|
||||||
|
* @param val if fire should be enabled or disabled
|
||||||
/**
|
*/
|
||||||
* @return world get world
|
public void setValue(boolean val) {
|
||||||
*/
|
value = val;
|
||||||
public SystemWorld getWorld() {
|
}
|
||||||
return world;
|
|
||||||
}
|
/**
|
||||||
|
* @return world get world
|
||||||
/**
|
*/
|
||||||
* @return get executor who toggles fire
|
public SystemWorld getWorld() {
|
||||||
*/
|
return world;
|
||||||
public CommandSender getExecutor() {
|
}
|
||||||
return executor;
|
|
||||||
}
|
/**
|
||||||
|
* @return get executor who toggles fire
|
||||||
|
*/
|
||||||
|
public CommandSender getExecutor() {
|
||||||
public final static HandlerList handlers = new HandlerList();
|
return executor;
|
||||||
|
}
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
@Override
|
||||||
}
|
public final HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
@Override
|
}
|
||||||
public final HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,55 +9,53 @@ import org.bukkit.event.HandlerList;
|
|||||||
* @since 09.05.2018
|
* @since 09.05.2018
|
||||||
*/
|
*/
|
||||||
public class WorldToggleTntEvent extends WorldEvent {
|
public class WorldToggleTntEvent extends WorldEvent {
|
||||||
|
|
||||||
private final SystemWorld world;
|
public final static HandlerList handlers = new HandlerList();
|
||||||
private final CommandSender executor;
|
private final SystemWorld world;
|
||||||
private boolean value;
|
private final CommandSender executor;
|
||||||
|
private boolean value;
|
||||||
public WorldToggleTntEvent(CommandSender executor, SystemWorld world, boolean value) {
|
|
||||||
this.executor = executor;
|
public WorldToggleTntEvent(CommandSender executor, SystemWorld world, boolean value) {
|
||||||
this.world = world;
|
this.executor = executor;
|
||||||
this.value = value;
|
this.world = world;
|
||||||
}
|
this.value = value;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @return if tnt now gets enabled or disabled
|
public static HandlerList getHandlerList() {
|
||||||
*/
|
return handlers;
|
||||||
public boolean getValue() {
|
}
|
||||||
return value;
|
|
||||||
}
|
/**
|
||||||
|
* @return if tnt now gets enabled or disabled
|
||||||
/**
|
*/
|
||||||
* @param val if tnt should be enabled or disabled
|
public boolean getValue() {
|
||||||
*/
|
return value;
|
||||||
public void setValue(boolean val) {
|
}
|
||||||
value = val;
|
|
||||||
}
|
/**
|
||||||
|
* @param val if tnt should be enabled or disabled
|
||||||
/**
|
*/
|
||||||
* @return world get world
|
public void setValue(boolean val) {
|
||||||
*/
|
value = val;
|
||||||
public SystemWorld getWorld() {
|
}
|
||||||
return world;
|
|
||||||
}
|
/**
|
||||||
|
* @return world get world
|
||||||
/**
|
*/
|
||||||
* @return get executor who toggles tnt
|
public SystemWorld getWorld() {
|
||||||
*/
|
return world;
|
||||||
public CommandSender getExecutor() {
|
}
|
||||||
return executor;
|
|
||||||
}
|
/**
|
||||||
|
* @return get executor who toggles tnt
|
||||||
|
*/
|
||||||
public final static HandlerList handlers = new HandlerList();
|
public CommandSender getExecutor() {
|
||||||
|
return executor;
|
||||||
public static HandlerList getHandlerList() {
|
}
|
||||||
return handlers;
|
|
||||||
}
|
@Override
|
||||||
|
public final HandlerList getHandlers() {
|
||||||
@Override
|
return handlers;
|
||||||
public final HandlerList getHandlers() {
|
}
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,28 +9,27 @@ import org.bukkit.event.HandlerList;
|
|||||||
*/
|
*/
|
||||||
public class WorldUnloadEvent extends WorldEvent {
|
public class WorldUnloadEvent extends WorldEvent {
|
||||||
|
|
||||||
private final SystemWorld world;
|
public final static HandlerList handlers = new HandlerList();
|
||||||
|
private final SystemWorld world;
|
||||||
public WorldUnloadEvent(SystemWorld world) {
|
|
||||||
this.world = world;
|
public WorldUnloadEvent(SystemWorld world) {
|
||||||
}
|
this.world = world;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @return world which gets unloaded
|
public static HandlerList getHandlerList() {
|
||||||
*/
|
return handlers;
|
||||||
public SystemWorld getWorld() {
|
}
|
||||||
return world;
|
|
||||||
}
|
/**
|
||||||
|
* @return world which gets unloaded
|
||||||
public final static HandlerList handlers = new HandlerList();
|
*/
|
||||||
|
public SystemWorld getWorld() {
|
||||||
public static HandlerList getHandlerList() {
|
return world;
|
||||||
return handlers;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public final HandlerList getHandlers() {
|
||||||
public final HandlerList getHandlers() {
|
return handlers;
|
||||||
return handlers;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,23 +9,23 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class GuiCommand implements CommandExecutor {
|
public class GuiCommand implements CommandExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage("You are not a player");
|
sender.sendMessage("You are not a player");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
WorldPlayer wp = new WorldPlayer((Player) sender);
|
WorldPlayer wp = new WorldPlayer((Player) sender);
|
||||||
if (!wp.isOnSystemWorld()) {
|
if (!wp.isOnSystemWorld()) {
|
||||||
sender.sendMessage(MessageConfig.getNotOnWorld());
|
sender.sendMessage(MessageConfig.getNotOnWorld());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!wp.isOwnerofWorld()) {
|
if (!wp.isOwnerofWorld()) {
|
||||||
sender.sendMessage(MessageConfig.getNoPermission());
|
sender.sendMessage(MessageConfig.getNoPermission());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
((Player) sender).openInventory(new WorldSystemGUI().getInventory((Player) sender));
|
((Player) sender).openInventory(new WorldSystemGUI().getInventory((Player) sender));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,55 +18,55 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class PlayerOptionsGUI extends OrcInventory {
|
public class PlayerOptionsGUI extends OrcInventory {
|
||||||
|
|
||||||
private final static String path = "options.player.";
|
private final static String path = "options.player.";
|
||||||
|
|
||||||
public PlayerOptionsGUI(Player loader, String otherPlayer, UUID other) {
|
|
||||||
super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.player").replace("%player", otherPlayer), GuiConfig.getRows("options.player"), GuiConfig.isFill("options.player"));
|
|
||||||
WorldPlayer wp = new WorldPlayer(Bukkit.getOfflinePlayer(other), loader.getWorld().getName());
|
|
||||||
loadItem("build", "/ws togglebuild " + otherPlayer, new BuildStatus(wp));
|
|
||||||
loadItem("gamemode", "/ws togglegm " + otherPlayer, new GamemodeStatus(wp));
|
|
||||||
loadItem("teleport", "/ws toggletp " + otherPlayer, new TeleportStatus(wp));
|
|
||||||
loadItem("worldedit", "/ws togglewe " + otherPlayer, new WorldEditStatus(wp));
|
|
||||||
loadItem("time");
|
|
||||||
loadItem("addmember");
|
|
||||||
loadItem("delmember");
|
|
||||||
loadItem("setpermissions");
|
|
||||||
loadItem("administrateworld");
|
|
||||||
|
|
||||||
if (GuiConfig.isEnabled(path + "back")) {
|
|
||||||
OrcItem back = OrcItem.back.clone();
|
|
||||||
back.setOnClick((p, inv, i) -> {
|
|
||||||
p.closeInventory();
|
|
||||||
PlayersPageGUI.openGUI(p);
|
|
||||||
});
|
|
||||||
addItem(GuiConfig.getSlot(path + "back"), back);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadItem(String subpath, String message, DependListener depend) {
|
public PlayerOptionsGUI(Player loader, String otherPlayer, UUID other) {
|
||||||
if (!GuiConfig.isEnabled(path + subpath))
|
super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.player").replace("%player", otherPlayer), GuiConfig.getRows("options.player"), GuiConfig.isFill("options.player"));
|
||||||
return;
|
WorldPlayer wp = new WorldPlayer(Bukkit.getOfflinePlayer(other), loader.getWorld().getName());
|
||||||
OrcItem item = GuiConfig.getItem(path + subpath);
|
loadItem("build", "/ws togglebuild " + otherPlayer, new BuildStatus(wp));
|
||||||
if (item != null) {
|
loadItem("gamemode", "/ws togglegm " + otherPlayer, new GamemodeStatus(wp));
|
||||||
if (message == null) {
|
loadItem("teleport", "/ws toggletp " + otherPlayer, new TeleportStatus(wp));
|
||||||
item.setOnClick(new ComingSoonClickListener());
|
loadItem("worldedit", "/ws togglewe " + otherPlayer, new WorldEditStatus(wp));
|
||||||
} else {
|
loadItem("time");
|
||||||
item.setOnClick(new CommandExecutorClickListener(message));
|
loadItem("addmember");
|
||||||
}
|
loadItem("delmember");
|
||||||
addItem(GuiConfig.getSlot(path + subpath), item);
|
loadItem("setpermissions");
|
||||||
if (depend == null) {
|
loadItem("administrateworld");
|
||||||
addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone());
|
|
||||||
} else {
|
|
||||||
addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadItem(String subpath, String message) {
|
if (GuiConfig.isEnabled(path + "back")) {
|
||||||
loadItem(subpath, message, null);
|
OrcItem back = OrcItem.back.clone();
|
||||||
}
|
back.setOnClick((p, inv, i) -> {
|
||||||
|
p.closeInventory();
|
||||||
|
PlayersPageGUI.openGUI(p);
|
||||||
|
});
|
||||||
|
addItem(GuiConfig.getSlot(path + "back"), back);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void loadItem(String subpath) {
|
public void loadItem(String subpath, String message, DependListener depend) {
|
||||||
loadItem(subpath, null);
|
if (!GuiConfig.isEnabled(path + subpath))
|
||||||
}
|
return;
|
||||||
|
OrcItem item = GuiConfig.getItem(path + subpath);
|
||||||
|
if (item != null) {
|
||||||
|
if (message == null) {
|
||||||
|
item.setOnClick(new ComingSoonClickListener());
|
||||||
|
} else {
|
||||||
|
item.setOnClick(new CommandExecutorClickListener(message));
|
||||||
|
}
|
||||||
|
addItem(GuiConfig.getSlot(path + subpath), item);
|
||||||
|
if (depend == null) {
|
||||||
|
addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone());
|
||||||
|
} else {
|
||||||
|
addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadItem(String subpath, String message) {
|
||||||
|
loadItem(subpath, message, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadItem(String subpath) {
|
||||||
|
loadItem(subpath, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,70 +22,72 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public class PlayersPageGUI {
|
public class PlayersPageGUI {
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void openGUI(Player p) {
|
public static void openGUI(Player p) {
|
||||||
WorldConfig config = WorldConfig.getWorldConfig(p.getWorld().getName());
|
WorldConfig config = WorldConfig.getWorldConfig(p.getWorld().getName());
|
||||||
|
|
||||||
HashMap<UUID, String> members = config.getMembersWithNames();
|
HashMap<UUID, String> members = config.getMembersWithNames();
|
||||||
|
|
||||||
if (members.size() == 0) {
|
if (members.size() == 0) {
|
||||||
p.sendMessage(MessageConfig.getNoMemberAdded());
|
p.sendMessage(MessageConfig.getNoMemberAdded());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PageGUICreator<Entry<UUID, String>> creator = new PageGUICreator<>(GuiConfig.getRows("options.players"));
|
PageGUICreator<Entry<UUID, String>> creator = new PageGUICreator<>(GuiConfig.getRows("options.players"));
|
||||||
|
|
||||||
creator.create(GuiConfig.getTitle(GuiConfig.getConfig(), "options.players"), members.entrySet(), (entry) -> {
|
creator.create(GuiConfig.getTitle(GuiConfig.getConfig(), "options.players"), members.entrySet(), (entry) -> {
|
||||||
String name = entry.getValue();
|
String name = entry.getValue();
|
||||||
OrcItem oi = new OrcItem(GuiConfig.getSkullItem(), GuiConfig
|
OrcItem oi = new OrcItem(GuiConfig.getSkullItem(), GuiConfig
|
||||||
.getDisplay(GuiConfig.getConfig(), "options.players.playerhead").replaceAll("%player", name));
|
.getDisplay(GuiConfig.getConfig(), "options.players.playerhead").replaceAll("%player", name));
|
||||||
SkullMeta sm = (SkullMeta) oi.getItemStack().getItemMeta();
|
SkullMeta sm = (SkullMeta) oi.getItemStack().getItemMeta();
|
||||||
sm.setOwner(name);
|
sm.setOwner(name);
|
||||||
oi.getItemStack().setItemMeta(sm);
|
oi.getItemStack().setItemMeta(sm);
|
||||||
oi.setOnClick((player, inv, item) -> {
|
oi.setOnClick((player, inv, item) -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
PlayerOptionsGUI gui = new PlayerOptionsGUI(player, name, entry.getKey());
|
PlayerOptionsGUI gui = new PlayerOptionsGUI(player, name, entry.getKey());
|
||||||
player.openInventory(gui.getInventory(p));
|
player.openInventory(gui.getInventory(p));
|
||||||
});
|
});
|
||||||
return oi;
|
return oi;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GuiConfig.isEnabled("options.players.back")) {
|
if (GuiConfig.isEnabled("options.players.back")) {
|
||||||
OrcItem back = OrcItem.back.clone();
|
OrcItem back = OrcItem.back.clone();
|
||||||
back.setOnClick((player, inv, i) -> {
|
back.setOnClick((player, inv, i) -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.openInventory(new WorldSystemGUI().getInventory(p));
|
player.openInventory(new WorldSystemGUI().getInventory(p));
|
||||||
});
|
});
|
||||||
creator.getInvPages().forEach((oi) -> {oi.addItem(GuiConfig.getSlot("options.players.back"), back);});
|
creator.getInvPages().forEach((oi) -> {
|
||||||
}
|
oi.addItem(GuiConfig.getSlot("options.players.back"), back);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
creator.show(p);
|
creator.show(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void preloadPlayers(WorldConfig config) {
|
public static void preloadPlayers(WorldConfig config) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
int headsPerInv = GuiConfig.getRows("options.players") * 9;
|
int headsPerInv = GuiConfig.getRows("options.players") * 9;
|
||||||
HashMap<UUID, String> members = config.getMembersWithNames();
|
HashMap<UUID, String> members = config.getMembersWithNames();
|
||||||
if (members == null || members.size() == 0)
|
if (members == null || members.size() == 0)
|
||||||
return;
|
return;
|
||||||
int pages = Math.round(members.size() / headsPerInv) < 1 ? 1 : Math.round(members.size() / headsPerInv);
|
int pages = Math.round(members.size() / headsPerInv) < 1 ? 1 : Math.round(members.size() / headsPerInv);
|
||||||
for (int page = 0; page < pages; page++) {
|
for (int page = 0; page < pages; page++) {
|
||||||
int startPos = pages == 1 ? 0 : headsPerInv * (page - 1);
|
int startPos = pages == 1 ? 0 : headsPerInv * (page - 1);
|
||||||
int length = pages == 1 ? members.size() : headsPerInv;
|
int length = pages == 1 ? members.size() : headsPerInv;
|
||||||
|
|
||||||
ArrayList<UUID> list = new ArrayList<>(members.keySet());
|
ArrayList<UUID> list = new ArrayList<>(members.keySet());
|
||||||
|
|
||||||
Inventory inv = Bukkit.createInventory(null, headsPerInv);
|
Inventory inv = Bukkit.createInventory(null, headsPerInv);
|
||||||
for (int i = startPos; i < startPos + length; i++) {
|
for (int i = startPos; i < startPos + length; i++) {
|
||||||
String name = members.get(list.get(i));
|
String name = members.get(list.get(i));
|
||||||
ItemStack is = new ItemStack(GuiConfig.getSkullItem(), 1, (short) 3);
|
ItemStack is = new ItemStack(GuiConfig.getSkullItem(), 1, (short) 3);
|
||||||
SkullMeta sm = (SkullMeta) is.getItemMeta();
|
SkullMeta sm = (SkullMeta) is.getItemMeta();
|
||||||
sm.setOwner(name);
|
sm.setOwner(name);
|
||||||
is.setItemMeta(sm);
|
is.setItemMeta(sm);
|
||||||
inv.addItem(is);
|
inv.addItem(is);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,83 +17,82 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class WorldOptionsGUI extends OrcInventory {
|
public class WorldOptionsGUI extends OrcInventory {
|
||||||
|
|
||||||
private final static String path = "options.world.";
|
public final static HashMap<UUID, String> data = new HashMap<>();
|
||||||
|
private final static String path = "options.world.";
|
||||||
|
|
||||||
public final static HashMap<UUID, String> data = new HashMap<>();
|
public WorldOptionsGUI() {
|
||||||
|
super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.world"), GuiConfig.getRows("options.world"), GuiConfig.isFill("options.world"));
|
||||||
|
|
||||||
public WorldOptionsGUI() {
|
loadItem("fire", "/ws fire", true, new FireStatus());
|
||||||
super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.world"), GuiConfig.getRows("options.world"), GuiConfig.isFill("options.world"));
|
loadItem("tnt", "/ws tnt", true, new TntStatus());
|
||||||
|
|
||||||
loadItem("fire", "/ws fire", true, new FireStatus());
|
if (!GuiConfig.isEnabled(path + "reset"))
|
||||||
loadItem("tnt", "/ws tnt", true, new TntStatus());
|
return;
|
||||||
|
|
||||||
if (!GuiConfig.isEnabled(path + "reset"))
|
OrcItem item = GuiConfig.getItem(path + "reset");
|
||||||
return;
|
if (item != null) {
|
||||||
|
item.setOnClick((p, inv, i) -> {
|
||||||
|
p.closeInventory();
|
||||||
|
p.chat("/ws reset");
|
||||||
|
});
|
||||||
|
addItem(GuiConfig.getSlot(path + "reset"), item);
|
||||||
|
}
|
||||||
|
|
||||||
OrcItem item = GuiConfig.getItem(path + "reset");
|
if (GuiConfig.isEnabled(path + "back")) {
|
||||||
if (item != null) {
|
OrcItem back = OrcItem.back.clone();
|
||||||
item.setOnClick((p, inv, i) -> {
|
back.setOnClick((p, inv, i) -> {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
p.chat("/ws reset");
|
p.openInventory(new WorldSystemGUI().getInventory(p));
|
||||||
});
|
});
|
||||||
addItem(GuiConfig.getSlot(path + "reset"), item);
|
addItem(GuiConfig.getSlot(path + "back"), back);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (GuiConfig.isEnabled(path + "back")) {
|
public void loadItem(String subpath, String message, boolean state, DependListener depend) {
|
||||||
OrcItem back = OrcItem.back.clone();
|
if (!GuiConfig.isEnabled(path + subpath))
|
||||||
back.setOnClick((p, inv, i) -> {
|
return;
|
||||||
p.closeInventory();
|
OrcItem item = GuiConfig.getItem(path + subpath);
|
||||||
p.openInventory(new WorldSystemGUI().getInventory(p));
|
if (item != null) {
|
||||||
});
|
if (message == null) {
|
||||||
addItem(GuiConfig.getSlot(path + "back"), back);
|
item.setOnClick(new ComingSoonClickListener());
|
||||||
}
|
} else {
|
||||||
}
|
item.setOnClick(new CommandExecutorClickListener(message));
|
||||||
|
}
|
||||||
|
if (state) {
|
||||||
|
if (depend == null) {
|
||||||
|
addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone());
|
||||||
|
} else {
|
||||||
|
addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addItem(GuiConfig.getSlot(path + subpath), item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void loadItem(String subpath, String message, boolean state, DependListener depend) {
|
public void loadItem(String subpath, String message, boolean state) {
|
||||||
if (!GuiConfig.isEnabled(path + subpath))
|
loadItem(subpath, message, state, null);
|
||||||
return;
|
}
|
||||||
OrcItem item = GuiConfig.getItem(path + subpath);
|
|
||||||
if (item != null) {
|
|
||||||
if (message == null) {
|
|
||||||
item.setOnClick(new ComingSoonClickListener());
|
|
||||||
} else {
|
|
||||||
item.setOnClick(new CommandExecutorClickListener(message));
|
|
||||||
}
|
|
||||||
if (state) {
|
|
||||||
if (depend == null) {
|
|
||||||
addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone());
|
|
||||||
} else {
|
|
||||||
addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
addItem(GuiConfig.getSlot(path + subpath), item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadItem(String subpath, String message, boolean state) {
|
public void loadItem(String subpath, boolean state) {
|
||||||
loadItem(subpath, message, state, null);
|
loadItem(subpath, null, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadItem(String subpath, boolean state) {
|
@Override
|
||||||
loadItem(subpath, null, state);
|
public Inventory getInventory(Player p, String title) {
|
||||||
}
|
if (data.containsKey(p.getUniqueId()))
|
||||||
|
return super.getInventory(p, title.replaceAll("%data", data.get(p.getUniqueId())));
|
||||||
|
return super.getInventory(p, title);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Inventory getInventory(Player p, String title) {
|
public Inventory getInventory(Player p) {
|
||||||
if (data.containsKey(p.getUniqueId()))
|
if (data.containsKey(p.getUniqueId()))
|
||||||
return super.getInventory(p, title.replaceAll("%data", data.get(p.getUniqueId())));
|
return super.getInventory(p, getTitle().replaceAll("%data", data.get(p.getUniqueId())));
|
||||||
return super.getInventory(p, title);
|
return super.getInventory(p, getTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public boolean canOpen(Player p) {
|
||||||
public Inventory getInventory(Player p) {
|
return new WorldPlayer(p).isOwnerofWorld();
|
||||||
if (data.containsKey(p.getUniqueId()))
|
}
|
||||||
return super.getInventory(p, getTitle().replaceAll("%data", data.get(p.getUniqueId())));
|
|
||||||
return super.getInventory(p, getTitle());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canOpen(Player p) {
|
|
||||||
return new WorldPlayer(p).isOwnerofWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,49 +11,49 @@ import org.bukkit.inventory.Inventory;
|
|||||||
|
|
||||||
public class WorldSystemGUI extends OrcInventory {
|
public class WorldSystemGUI extends OrcInventory {
|
||||||
|
|
||||||
private final static String path = "worldsystem.";
|
private final static String path = "worldsystem.";
|
||||||
|
|
||||||
public WorldSystemGUI() {
|
public WorldSystemGUI() {
|
||||||
|
|
||||||
super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldsystem"), GuiConfig.getRows("worldsystem"), GuiConfig.isFill("worldsystem"));
|
super(GuiConfig.getTitle(GuiConfig.getConfig(), "worldsystem"), GuiConfig.getRows("worldsystem"), GuiConfig.isFill("worldsystem"));
|
||||||
|
|
||||||
loadItem("playeroptions", (p, inv, item) -> {
|
loadItem("playeroptions", (p, inv, item) -> {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
PlayersPageGUI.openGUI(p);
|
PlayersPageGUI.openGUI(p);
|
||||||
});
|
});
|
||||||
|
|
||||||
loadItem("worldoptions", new InventoryOpenClickListener(new WorldOptionsGUI()));
|
loadItem("worldoptions", new InventoryOpenClickListener(new WorldOptionsGUI()));
|
||||||
|
|
||||||
if (GuiConfig.isEnabled(path + "back")) {
|
if (GuiConfig.isEnabled(path + "back")) {
|
||||||
OrcItem back = OrcItem.back.clone();
|
OrcItem back = OrcItem.back.clone();
|
||||||
back.setOnClick((p, inv, item) -> {
|
back.setOnClick((p, inv, item) -> {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
});
|
});
|
||||||
addItem(GuiConfig.getSlot(path + "back"), back);
|
addItem(GuiConfig.getSlot(path + "back"), back);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Inventory getInventory(Player player) {
|
public Inventory getInventory(Player player) {
|
||||||
PlayersPageGUI.preloadPlayers(WorldConfig.getWorldConfig(player.getWorld().getName()));
|
PlayersPageGUI.preloadPlayers(WorldConfig.getWorldConfig(player.getWorld().getName()));
|
||||||
return super.getInventory(player);
|
return super.getInventory(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadItem(String subpath, OrcClickListener listener) {
|
public void loadItem(String subpath, OrcClickListener listener) {
|
||||||
if (!GuiConfig.isEnabled(path + subpath))
|
if (!GuiConfig.isEnabled(path + subpath))
|
||||||
return;
|
return;
|
||||||
OrcItem item = GuiConfig.getItem(path + subpath);
|
OrcItem item = GuiConfig.getItem(path + subpath);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.setOnClick(listener);
|
item.setOnClick(listener);
|
||||||
addItem(GuiConfig.getSlot(path + subpath), item);
|
addItem(GuiConfig.getSlot(path + subpath), item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadItem(String subpath) {
|
public void loadItem(String subpath) {
|
||||||
loadItem(subpath, null);
|
loadItem(subpath, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canOpen(Player p) {
|
public boolean canOpen(Player p) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,10 +7,10 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class ComingSoonClickListener implements OrcClickListener {
|
public class ComingSoonClickListener implements OrcClickListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
p.sendMessage("§cComing soon...");
|
p.sendMessage("§cComing soon...");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,18 +6,18 @@ import de.butzlabben.inventory.OrcItem;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CommandExecutorClickListener implements OrcClickListener {
|
public class CommandExecutorClickListener implements OrcClickListener {
|
||||||
|
|
||||||
private final String message;
|
|
||||||
|
|
||||||
public CommandExecutorClickListener(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
private final String message;
|
||||||
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
|
||||||
p.closeInventory();
|
public CommandExecutorClickListener(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
||||||
|
p.closeInventory();
|
||||||
p.chat(message);
|
p.chat(message);
|
||||||
// Fix for #9
|
// Fix for #9
|
||||||
inv.redraw(p);
|
inv.redraw(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,25 +9,25 @@ import org.bukkit.inventory.Inventory;
|
|||||||
|
|
||||||
public class InventoryOpenClickListener implements OrcClickListener {
|
public class InventoryOpenClickListener implements OrcClickListener {
|
||||||
|
|
||||||
private final OrcInventory open;
|
private final OrcInventory open;
|
||||||
|
|
||||||
public InventoryOpenClickListener(OrcInventory inv) {
|
public InventoryOpenClickListener(OrcInventory inv) {
|
||||||
open = inv;
|
open = inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
public void onClick(Player p, OrcInventory inv, OrcItem item) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
if (open == null) {
|
if (open == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Inventory to = open.getInventory(p);
|
Inventory to = open.getInventory(p);
|
||||||
if (to != null) {
|
if (to != null) {
|
||||||
p.openInventory(to);
|
p.openInventory(to);
|
||||||
} else {
|
} else {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
p.sendMessage(MessageConfig.getNoPermission());
|
p.sendMessage(MessageConfig.getNoPermission());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,15 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class BuildStatus implements DependListener {
|
public class BuildStatus implements DependListener {
|
||||||
|
|
||||||
private final WorldPlayer wp;
|
|
||||||
|
|
||||||
public BuildStatus(WorldPlayer wp) {
|
private final WorldPlayer wp;
|
||||||
this.wp = wp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public BuildStatus(WorldPlayer wp) {
|
||||||
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
this.wp = wp;
|
||||||
return wp.canBuild() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
||||||
|
return wp.canBuild() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,15 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class GamemodeStatus implements DependListener {
|
public class GamemodeStatus implements DependListener {
|
||||||
|
|
||||||
private final WorldPlayer wp;
|
|
||||||
|
|
||||||
public GamemodeStatus(WorldPlayer wp) {
|
private final WorldPlayer wp;
|
||||||
this.wp = wp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public GamemodeStatus(WorldPlayer wp) {
|
||||||
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
this.wp = wp;
|
||||||
return wp.canChangeGamemode() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
||||||
|
return wp.canChangeGamemode() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
||||||
|
}
|
||||||
}
|
}
|
@ -8,14 +8,14 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class TeleportStatus implements DependListener {
|
public class TeleportStatus implements DependListener {
|
||||||
|
|
||||||
private final WorldPlayer wp;
|
private final WorldPlayer wp;
|
||||||
|
|
||||||
public TeleportStatus(WorldPlayer wp) {
|
public TeleportStatus(WorldPlayer wp) {
|
||||||
this.wp = wp;
|
this.wp = wp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
public ItemStack getItemStack(Player p, WorldPlayer player) {
|
||||||
return wp.canTeleport() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
return wp.canTeleport() ? OrcItem.enabled.getItemStack(p, wp) : OrcItem.disabled.getItemStack(p, wp);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,22 +13,22 @@ import java.io.File;
|
|||||||
|
|
||||||
public class FireStatus implements DependListener {
|
public class FireStatus implements DependListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
||||||
String worldname = new DependenceConfig(p).getWorldname();
|
String worldname = new DependenceConfig(p).getWorldname();
|
||||||
File file = new File(worldname + "/worldconfig.yml");
|
File file = new File(worldname + "/worldconfig.yml");
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml");
|
file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml");
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
return null;
|
return null;
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
||||||
boolean b = cfg.getBoolean("Settings.Fire");
|
boolean b = cfg.getBoolean("Settings.Fire");
|
||||||
if (b)
|
if (b)
|
||||||
return OrcItem.enabled.getItemStack(p);
|
return OrcItem.enabled.getItemStack(p);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
// TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp);
|
// TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp);
|
||||||
// sonst return null
|
// sonst return null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,22 +13,22 @@ import java.io.File;
|
|||||||
|
|
||||||
public class TntStatus implements DependListener {
|
public class TntStatus implements DependListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
public ItemStack getItemStack(Player p, WorldPlayer wp) {
|
||||||
String worldname = new DependenceConfig(p).getWorldname();
|
String worldname = new DependenceConfig(p).getWorldname();
|
||||||
File file = new File(worldname + "/worldconfig.yml");
|
File file = new File(worldname + "/worldconfig.yml");
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml");
|
file = new File(PluginConfig.getWorlddir() + "/worldconfig.yml");
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
return null;
|
return null;
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
||||||
boolean b = cfg.getBoolean("Settings.TNTDamage");
|
boolean b = cfg.getBoolean("Settings.TNTDamage");
|
||||||
if (b)
|
if (b)
|
||||||
return OrcItem.enabled.getItemStack(p);
|
return OrcItem.enabled.getItemStack(p);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
// TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp);
|
// TODO wenn enabled, dann return OrcItem.enabled.getItemStack(p, wp);
|
||||||
// sonst return null
|
// sonst return null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,62 +15,63 @@ import java.io.File;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class BlockListener implements Listener {
|
public class BlockListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onExplode(EntityExplodeEvent e) {
|
|
||||||
File file = WorldConfig.getWorldFile(Objects.requireNonNull(e.getLocation().getWorld()).getName());
|
|
||||||
if(!file.exists())
|
|
||||||
return;
|
|
||||||
WorldConfig wc = WorldConfig.getWorldConfig(e.getLocation().getWorld().getName());
|
|
||||||
e.setCancelled(!wc.isTnt());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlace(BlockPlaceEvent e) {
|
public void onExplode(EntityExplodeEvent e) {
|
||||||
Player p = e.getPlayer();
|
File file = WorldConfig.getWorldFile(Objects.requireNonNull(e.getLocation().getWorld()).getName());
|
||||||
if (p.hasPermission("ws.build"))
|
if (!file.exists())
|
||||||
return;
|
return;
|
||||||
String worldname = p.getWorld().getName();
|
WorldConfig wc = WorldConfig.getWorldConfig(e.getLocation().getWorld().getName());
|
||||||
WorldPlayer wp = new WorldPlayer(p, worldname);
|
e.setCancelled(!wc.isTnt());
|
||||||
if (!wp.isOnSystemWorld())
|
}
|
||||||
return;
|
|
||||||
if(!wp.isMember())
|
|
||||||
e.setCancelled(true);
|
|
||||||
if (!wp.isOwnerofWorld()) {
|
|
||||||
e.setCancelled(!wp.canBuild());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBreak(BlockBreakEvent e) {
|
public void onPlace(BlockPlaceEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
if (p.hasPermission("ws.build"))
|
if (p.hasPermission("ws.build"))
|
||||||
return;
|
return;
|
||||||
String worldname = p.getWorld().getName();
|
String worldname = p.getWorld().getName();
|
||||||
WorldPlayer wp = new WorldPlayer(p, worldname);
|
WorldPlayer wp = new WorldPlayer(p, worldname);
|
||||||
if (!wp.isOnSystemWorld())
|
if (!wp.isOnSystemWorld())
|
||||||
return;
|
return;
|
||||||
if(!wp.isMember())
|
if (!wp.isMember())
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
if (!wp.isOwnerofWorld()) {
|
if (!wp.isOwnerofWorld()) {
|
||||||
e.setCancelled(!wp.canBuild());
|
e.setCancelled(!wp.canBuild());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
|
||||||
public void onFire(BlockIgniteEvent e) {
|
|
||||||
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
|
|
||||||
if(!file.exists())
|
|
||||||
return;
|
|
||||||
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
|
|
||||||
e.setCancelled(!wc.isFire());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFire(BlockBurnEvent e) {
|
public void onBreak(BlockBreakEvent e) {
|
||||||
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
|
Player p = e.getPlayer();
|
||||||
if(!file.exists())
|
if (p.hasPermission("ws.build"))
|
||||||
return;
|
return;
|
||||||
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
|
String worldname = p.getWorld().getName();
|
||||||
e.setCancelled(!wc.isFire());
|
WorldPlayer wp = new WorldPlayer(p, worldname);
|
||||||
}
|
if (!wp.isOnSystemWorld())
|
||||||
|
return;
|
||||||
|
if (!wp.isMember())
|
||||||
|
e.setCancelled(true);
|
||||||
|
if (!wp.isOwnerofWorld()) {
|
||||||
|
e.setCancelled(!wp.canBuild());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onFire(BlockIgniteEvent e) {
|
||||||
|
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
|
||||||
|
if (!file.exists())
|
||||||
|
return;
|
||||||
|
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
|
||||||
|
e.setCancelled(!wc.isFire());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onFire(BlockBurnEvent e) {
|
||||||
|
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
|
||||||
|
if (!file.exists())
|
||||||
|
return;
|
||||||
|
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
|
||||||
|
e.setCancelled(!wc.isFire());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,36 +15,36 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class PlayerDeathListener implements Listener {
|
public class PlayerDeathListener implements Listener {
|
||||||
|
|
||||||
private final HashMap<UUID, World> deathLocations = new HashMap<>();
|
private final HashMap<UUID, World> deathLocations = new HashMap<>();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDie(PlayerDeathEvent e) {
|
public void onDie(PlayerDeathEvent e) {
|
||||||
Player p = e.getEntity();
|
Player p = e.getEntity();
|
||||||
WorldPlayer wp = new WorldPlayer(p, p.getWorld().getName());
|
WorldPlayer wp = new WorldPlayer(p, p.getWorld().getName());
|
||||||
if (wp.isOnSystemWorld()) {
|
if (wp.isOnSystemWorld()) {
|
||||||
deathLocations.put(p.getUniqueId(), p.getLocation().getWorld());
|
deathLocations.put(p.getUniqueId(), p.getLocation().getWorld());
|
||||||
} else {
|
} else {
|
||||||
p.setGameMode(PluginConfig.getSpawnGamemode());
|
p.setGameMode(PluginConfig.getSpawnGamemode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onRespawn(PlayerRespawnEvent e) {
|
public void onRespawn(PlayerRespawnEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
if (deathLocations.containsKey(p.getUniqueId())) {
|
if (deathLocations.containsKey(p.getUniqueId())) {
|
||||||
World world = deathLocations.remove(p.getUniqueId());
|
World world = deathLocations.remove(p.getUniqueId());
|
||||||
|
|
||||||
WorldConfig config = WorldConfig.getWorldConfig(world.getName());
|
WorldConfig config = WorldConfig.getWorldConfig(world.getName());
|
||||||
|
|
||||||
if (config.getHome() != null) {
|
if (config.getHome() != null) {
|
||||||
e.setRespawnLocation(config.getHome());
|
e.setRespawnLocation(config.getHome());
|
||||||
} else {
|
} else {
|
||||||
if (PluginConfig.useWorldSpawn()) {
|
if (PluginConfig.useWorldSpawn()) {
|
||||||
e.setRespawnLocation(PluginConfig.getWorldSpawn(world));
|
e.setRespawnLocation(PluginConfig.getWorldSpawn(world));
|
||||||
} else {
|
} else {
|
||||||
e.setRespawnLocation(world.getSpawnLocation());
|
e.setRespawnLocation(world.getSpawnLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,31 +16,31 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
|
|
||||||
//#17
|
//#17
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
if (PluginConfig.spawnTeleportation()) {
|
if (PluginConfig.spawnTeleportation()) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
DependenceConfig dc = new DependenceConfig(p);
|
DependenceConfig dc = new DependenceConfig(p);
|
||||||
if (dc.hasWorld()) {
|
if (dc.hasWorld()) {
|
||||||
SystemWorld sw = SystemWorld.getSystemWorld(dc.getWorldname());
|
SystemWorld sw = SystemWorld.getSystemWorld(dc.getWorldname());
|
||||||
if (sw != null && !sw.isLoaded()) {
|
if (sw != null && !sw.isLoaded()) {
|
||||||
e.getPlayer().teleport(PluginConfig.getSpawn(e.getPlayer()));
|
e.getPlayer().teleport(PluginConfig.getSpawn(e.getPlayer()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLeave(PlayerQuitEvent e) {
|
public void onLeave(PlayerQuitEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
World w = p.getWorld();
|
World w = p.getWorld();
|
||||||
WorldPlayer player = new WorldPlayer(p);
|
WorldPlayer player = new WorldPlayer(p);
|
||||||
// Save last location for #23
|
// Save last location for #23
|
||||||
if (player.isOnSystemWorld()) {
|
if (player.isOnSystemWorld()) {
|
||||||
WorldConfig config = WorldConfig.getWorldConfig(player.getWorldname());
|
WorldConfig config = WorldConfig.getWorldConfig(player.getWorldname());
|
||||||
PlayerPositions.getInstance().saveWorldsPlayerLocation(p, config);
|
PlayerPositions.getInstance().saveWorldsPlayerLocation(p, config);
|
||||||
}
|
}
|
||||||
SystemWorld.tryUnloadLater(w);
|
SystemWorld.tryUnloadLater(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,13 +1,11 @@
|
|||||||
package de.butzlabben.world.listener;
|
package de.butzlabben.world.listener;
|
||||||
|
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldedit.extension.platform.CommandManager;
|
|
||||||
import de.butzlabben.world.config.MessageConfig;
|
import de.butzlabben.world.config.MessageConfig;
|
||||||
import de.butzlabben.world.config.WorldConfig;
|
import de.butzlabben.world.config.WorldConfig;
|
||||||
import de.butzlabben.world.config.WorldPerm;
|
import de.butzlabben.world.config.WorldPerm;
|
||||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -37,7 +35,7 @@ public class WorldEditListener implements Listener {
|
|||||||
private boolean isWorldEditCommand(String command) {
|
private boolean isWorldEditCommand(String command) {
|
||||||
WorldEditPlugin plugin = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
|
WorldEditPlugin plugin = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
|
||||||
// WorldEdit plugin not foung
|
// WorldEdit plugin not foung
|
||||||
if(plugin == null)
|
if (plugin == null)
|
||||||
return false;
|
return false;
|
||||||
if (command.startsWith("/")) {
|
if (command.startsWith("/")) {
|
||||||
command = command.replaceFirst("/", "");
|
command = command.replaceFirst("/", "");
|
||||||
|
@ -32,6 +32,9 @@ public class MoneyUtil {
|
|||||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Couldn't find a Vault Economy extension");
|
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Couldn't find a Vault Economy extension");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MoneyUtil() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void removeMoney(UUID uuid, int money) {
|
public static void removeMoney(UUID uuid, int money) {
|
||||||
Preconditions.checkNotNull(uuid);
|
Preconditions.checkNotNull(uuid);
|
||||||
Preconditions.checkNotNull(economy);
|
Preconditions.checkNotNull(economy);
|
||||||
@ -53,7 +56,4 @@ public class MoneyUtil {
|
|||||||
Economy economy = (Economy) MoneyUtil.economy;
|
Economy economy = (Economy) MoneyUtil.economy;
|
||||||
return economy.getBalance(op) >= money;
|
return economy.getBalance(op) >= money;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MoneyUtil() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,10 @@ public class PlayerPositions {
|
|||||||
private final DatabaseUtil util = DatabaseRepository.getInstance().getUtil();
|
private final DatabaseUtil util = DatabaseRepository.getInstance().getUtil();
|
||||||
|
|
||||||
|
|
||||||
|
private PlayerPositions() {
|
||||||
|
checkTables();
|
||||||
|
}
|
||||||
|
|
||||||
public Location injectWorldsLocation(Player player, WorldConfig config, Location location) {
|
public Location injectWorldsLocation(Player player, WorldConfig config, Location location) {
|
||||||
if (!PluginConfig.useWorldSpawnLastLocation())
|
if (!PluginConfig.useWorldSpawnLastLocation())
|
||||||
return location;
|
return location;
|
||||||
@ -65,7 +69,7 @@ public class PlayerPositions {
|
|||||||
public Location injectPlayersLocation(Player player, Location location) {
|
public Location injectPlayersLocation(Player player, Location location) {
|
||||||
if (!PluginConfig.useSpawnLastLocation())
|
if (!PluginConfig.useSpawnLastLocation())
|
||||||
return location;
|
return location;
|
||||||
if(player == null)
|
if (player == null)
|
||||||
return location;
|
return location;
|
||||||
Preconditions.checkNotNull(location);
|
Preconditions.checkNotNull(location);
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
@ -198,8 +202,4 @@ public class PlayerPositions {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayerPositions() {
|
|
||||||
checkTables();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -11,19 +11,19 @@ import java.util.UUID;
|
|||||||
* @since 13.09.2018
|
* @since 13.09.2018
|
||||||
*/
|
*/
|
||||||
public class TeleportUtil {
|
public class TeleportUtil {
|
||||||
|
|
||||||
private static final HashMap<UUID, Location> oldLocs = new HashMap<>();
|
|
||||||
|
|
||||||
public static void teleportPlayer(Player p, Location loc) {
|
|
||||||
// Save old player location.
|
|
||||||
// If he does another teleport he will be taken back then to the first location
|
|
||||||
if(!oldLocs.containsKey(p.getUniqueId())) {
|
|
||||||
Location oldLoc = p.getLocation();
|
|
||||||
oldLocs.put(p.getUniqueId(), oldLoc);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private TeleportUtil() {
|
private static final HashMap<UUID, Location> oldLocs = new HashMap<>();
|
||||||
}
|
|
||||||
|
private TeleportUtil() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void teleportPlayer(Player p, Location loc) {
|
||||||
|
// Save old player location.
|
||||||
|
// If he does another teleport he will be taken back then to the first location
|
||||||
|
if (!oldLocs.containsKey(p.getUniqueId())) {
|
||||||
|
Location oldLoc = p.getLocation();
|
||||||
|
oldLocs.put(p.getUniqueId(), oldLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,9 @@ public class VersionUtil {
|
|||||||
|
|
||||||
private static int version;
|
private static int version;
|
||||||
|
|
||||||
|
private VersionUtil() {
|
||||||
|
}
|
||||||
|
|
||||||
public static int getVersion() {
|
public static int getVersion() {
|
||||||
if (version == 0) {
|
if (version == 0) {
|
||||||
// Detect version
|
// Detect version
|
||||||
@ -46,7 +49,4 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
private VersionUtil() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ package de.butzlabben.world.util.database;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
|
||||||
public abstract class DatabaseConnection implements DatabaseUtil {
|
public abstract class DatabaseConnection implements DatabaseUtil {
|
||||||
Connection connection;
|
|
||||||
final Object lock = new Object();
|
final Object lock = new Object();
|
||||||
|
Connection connection;
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
|
@ -7,8 +7,12 @@ import java.sql.SQLException;
|
|||||||
public interface DatabaseUtil {
|
public interface DatabaseUtil {
|
||||||
|
|
||||||
ResultSet executeQuery(PreparedStatement preparedStatement) throws SQLException;
|
ResultSet executeQuery(PreparedStatement preparedStatement) throws SQLException;
|
||||||
|
|
||||||
int executeUpdate(PreparedStatement preparedStatement) throws SQLException;
|
int executeUpdate(PreparedStatement preparedStatement) throws SQLException;
|
||||||
|
|
||||||
PreparedStatement prepareStatement(String sql) throws SQLException;
|
PreparedStatement prepareStatement(String sql) throws SQLException;
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
void connect();
|
void connect();
|
||||||
}
|
}
|
||||||
|
@ -15,28 +15,28 @@ import java.util.Objects;
|
|||||||
*/
|
*/
|
||||||
public class AsyncCreatorAdapter implements CreatorAdapter {
|
public class AsyncCreatorAdapter implements CreatorAdapter {
|
||||||
|
|
||||||
// Create worlds async to close #16
|
// Create worlds async to close #16
|
||||||
@Override
|
@Override
|
||||||
public void create(WorldCreator creator, SystemWorld sw, Runnable r) {
|
public void create(WorldCreator creator, SystemWorld sw, Runnable r) {
|
||||||
TaskManager.IMP.async(() -> {
|
TaskManager.IMP.async(() -> {
|
||||||
AsyncWorld world;
|
AsyncWorld world;
|
||||||
if (Bukkit.getWorld(creator.name()) == null)
|
if (Bukkit.getWorld(creator.name()) == null)
|
||||||
world = AsyncWorld.create(creator);
|
world = AsyncWorld.create(creator);
|
||||||
else
|
else
|
||||||
world = AsyncWorld.wrap(Objects.requireNonNull(Bukkit.getWorld(creator.name())));
|
world = AsyncWorld.wrap(Objects.requireNonNull(Bukkit.getWorld(creator.name())));
|
||||||
|
|
||||||
Block block = world.getBlockAt(0, 0, 0);
|
Block block = world.getBlockAt(0, 0, 0);
|
||||||
block.setType(Material.BEDROCK);
|
block.setType(Material.BEDROCK);
|
||||||
|
|
||||||
// When you are done
|
// When you are done
|
||||||
world.commit();
|
world.commit();
|
||||||
Bukkit.getWorlds().add(world);
|
Bukkit.getWorlds().add(world);
|
||||||
if (sw != null)
|
if (sw != null)
|
||||||
sw.setCreating(false);
|
sw.setCreating(false);
|
||||||
|
|
||||||
// Send the message
|
// Send the message
|
||||||
r.run();
|
r.run();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,5 @@ import org.bukkit.WorldCreator;
|
|||||||
*/
|
*/
|
||||||
public interface CreatorAdapter {
|
public interface CreatorAdapter {
|
||||||
|
|
||||||
void create(WorldCreator creator, SystemWorld world, Runnable sendPlayerMessageCallback);
|
void create(WorldCreator creator, SystemWorld world, Runnable sendPlayerMessageCallback);
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,16 @@ import java.util.HashMap;
|
|||||||
*/
|
*/
|
||||||
public class SystemWorld {
|
public class SystemWorld {
|
||||||
|
|
||||||
|
private static final HashMap<String, SystemWorld> cached = new HashMap<>();
|
||||||
private World w;
|
private World w;
|
||||||
private String worldname;
|
private String worldname;
|
||||||
private boolean unloading = false;
|
private boolean unloading = false;
|
||||||
private boolean creating = false;
|
private boolean creating = false;
|
||||||
|
|
||||||
private static final HashMap<String, SystemWorld> cached = new HashMap<>();
|
private SystemWorld(String worldname) {
|
||||||
|
this.worldname = worldname;
|
||||||
|
w = Bukkit.getWorld(worldname);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is the online way to get a system world instance
|
* This method is the online way to get a system world instance
|
||||||
@ -66,9 +70,99 @@ public class SystemWorld {
|
|||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SystemWorld(String worldname) {
|
/**
|
||||||
this.worldname = worldname;
|
* Trys to create a new systemworld with all entries etc. finally loads the
|
||||||
w = Bukkit.getWorld(worldname);
|
* world
|
||||||
|
*
|
||||||
|
* @param p Player to create the world for
|
||||||
|
* @return whether it succesfull or not
|
||||||
|
*/
|
||||||
|
public static boolean create(Player p, WorldTemplate template) {
|
||||||
|
|
||||||
|
DependenceConfig dc = new DependenceConfig(p);
|
||||||
|
|
||||||
|
String uuid = p.getUniqueId().toString();
|
||||||
|
int id = DependenceConfig.getHighestID() + 1;
|
||||||
|
String worldname = "ID" + id + "-" + uuid;
|
||||||
|
|
||||||
|
WorldCreator creator = template.getGeneratorSettings().asWorldCreator(worldname);
|
||||||
|
|
||||||
|
WorldCreateEvent event = new WorldCreateEvent(p, creator);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
if (event.isCancelled())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
dc.createNewEntry();
|
||||||
|
|
||||||
|
String worlddir = PluginConfig.getWorlddir();
|
||||||
|
File exampleworld = new File(template.getPath());
|
||||||
|
if (new File(template.getPath() + "/uid.dat").exists()) {
|
||||||
|
new File(template.getPath() + "/uid.dat").delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
File newworld = new File(worlddir + "/" + worldname);
|
||||||
|
|
||||||
|
if (exampleworld.isDirectory())
|
||||||
|
try {
|
||||||
|
FileUtils.copyDirectory(exampleworld, newworld);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Couldn't create world for " + p.getName());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
newworld.mkdirs();
|
||||||
|
|
||||||
|
WorldConfig.create(p, template);
|
||||||
|
|
||||||
|
// Move World into Server dir
|
||||||
|
File world = new File(worlddir + "/" + worldname);
|
||||||
|
if (!world.exists()) {
|
||||||
|
world = new File(Bukkit.getWorldContainer(), worldname);
|
||||||
|
} else {
|
||||||
|
if (new File(Bukkit.getWorldContainer(), worldname).exists()
|
||||||
|
&& new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) {
|
||||||
|
try {
|
||||||
|
FileUtils.deleteDirectory(new File(Bukkit.getWorldContainer(), worldname));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false);
|
||||||
|
} catch (IOException e) {
|
||||||
|
p.sendMessage(PluginConfig.getPrefix() + "§cError: " + e.getMessage());
|
||||||
|
System.err.println("Couldn't load world of " + p.getName());
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemWorld sw = SystemWorld.getSystemWorld(worldname);
|
||||||
|
sw.setCreating(true);
|
||||||
|
|
||||||
|
// Run in scheduler so method returns without delay
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> {
|
||||||
|
// Fix for #16
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (p != null && p.isOnline()) {
|
||||||
|
p.sendMessage(MessageConfig.getWorldCreated());
|
||||||
|
SettingsConfig.getCommandsonGet().stream()
|
||||||
|
.map(s -> s.replace("%player", p.getName()).replace("%world", sw.getName())
|
||||||
|
.replace("%uuid", p.getUniqueId().toString()))
|
||||||
|
.forEach(s -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTask(WorldSystem.getInstance());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}.runTaskLater(WorldSystem.getInstance(), 1);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,101 +344,6 @@ public class SystemWorld {
|
|||||||
dc.setLastLoaded();
|
dc.setLastLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Trys to create a new systemworld with all entries etc. finally loads the
|
|
||||||
* world
|
|
||||||
*
|
|
||||||
* @param p Player to create the world for
|
|
||||||
* @return whether it succesfull or not
|
|
||||||
*/
|
|
||||||
public static boolean create(Player p, WorldTemplate template) {
|
|
||||||
|
|
||||||
DependenceConfig dc = new DependenceConfig(p);
|
|
||||||
|
|
||||||
String uuid = p.getUniqueId().toString();
|
|
||||||
int id = DependenceConfig.getHighestID() + 1;
|
|
||||||
String worldname = "ID" + id + "-" + uuid;
|
|
||||||
|
|
||||||
WorldCreator creator = template.getGeneratorSettings().asWorldCreator(worldname);
|
|
||||||
|
|
||||||
WorldCreateEvent event = new WorldCreateEvent(p, creator);
|
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
if (event.isCancelled())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
dc.createNewEntry();
|
|
||||||
|
|
||||||
String worlddir = PluginConfig.getWorlddir();
|
|
||||||
File exampleworld = new File(template.getPath());
|
|
||||||
if (new File(template.getPath() + "/uid.dat").exists()) {
|
|
||||||
new File(template.getPath() + "/uid.dat").delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
File newworld = new File(worlddir + "/" + worldname);
|
|
||||||
|
|
||||||
if (exampleworld.isDirectory())
|
|
||||||
try {
|
|
||||||
FileUtils.copyDirectory(exampleworld, newworld);
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("Couldn't create world for " + p.getName());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
newworld.mkdirs();
|
|
||||||
|
|
||||||
WorldConfig.create(p, template);
|
|
||||||
|
|
||||||
// Move World into Server dir
|
|
||||||
File world = new File(worlddir + "/" + worldname);
|
|
||||||
if (!world.exists()) {
|
|
||||||
world = new File(Bukkit.getWorldContainer(), worldname);
|
|
||||||
} else {
|
|
||||||
if (new File(Bukkit.getWorldContainer(), worldname).exists()
|
|
||||||
&& new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) {
|
|
||||||
try {
|
|
||||||
FileUtils.deleteDirectory(new File(Bukkit.getWorldContainer(), worldname));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false);
|
|
||||||
} catch (IOException e) {
|
|
||||||
p.sendMessage(PluginConfig.getPrefix() + "§cError: " + e.getMessage());
|
|
||||||
System.err.println("Couldn't load world of " + p.getName());
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SystemWorld sw = SystemWorld.getSystemWorld(worldname);
|
|
||||||
sw.setCreating(true);
|
|
||||||
|
|
||||||
// Run in scheduler so method returns without delay
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> {
|
|
||||||
// Fix for #16
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (p != null && p.isOnline()) {
|
|
||||||
p.sendMessage(MessageConfig.getWorldCreated());
|
|
||||||
SettingsConfig.getCommandsonGet().stream()
|
|
||||||
.map(s -> s.replace("%player", p.getName()).replace("%world", sw.getName())
|
|
||||||
.replace("%uuid", p.getUniqueId().toString()))
|
|
||||||
.forEach(s -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.runTask(WorldSystem.getInstance());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}.runTaskLater(WorldSystem.getInstance(), 1);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if the world is loaded
|
* @return if the world is loaded
|
||||||
*/
|
*/
|
||||||
@ -413,14 +412,14 @@ public class SystemWorld {
|
|||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreating(boolean creating) {
|
|
||||||
this.creating = creating;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCreating() {
|
public boolean isCreating() {
|
||||||
return creating;
|
return creating;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCreating(boolean creating) {
|
||||||
|
this.creating = creating;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the worldname
|
* @return the worldname
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +24,15 @@ public class WorldPlayer {
|
|||||||
private final OfflinePlayer p;
|
private final OfflinePlayer p;
|
||||||
private final String worldname;
|
private final String worldname;
|
||||||
|
|
||||||
|
public WorldPlayer(OfflinePlayer p, String worldname) {
|
||||||
|
this.p = p;
|
||||||
|
this.worldname = worldname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorldPlayer(Player p) {
|
||||||
|
this(p, p.getWorld().getName());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the worldname, where the worldplayer object was created for
|
* @return the worldname, where the worldplayer object was created for
|
||||||
*/
|
*/
|
||||||
@ -87,7 +96,6 @@ public class WorldPlayer {
|
|||||||
return wc.canWorldEdit(this.p.getUniqueId());
|
return wc.canWorldEdit(this.p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* toggles teleporting for this player
|
* toggles teleporting for this player
|
||||||
*
|
*
|
||||||
@ -162,15 +170,6 @@ public class WorldPlayer {
|
|||||||
return wc.isMember(p.getUniqueId());
|
return wc.isMember(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldPlayer(OfflinePlayer p, String worldname) {
|
|
||||||
this.p = p;
|
|
||||||
this.worldname = worldname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WorldPlayer(Player p) {
|
|
||||||
this(p, p.getWorld().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if he is on a systemworld or not
|
* @return if he is on a systemworld or not
|
||||||
*/
|
*/
|
||||||
|
@ -15,11 +15,6 @@ import java.util.HashMap;
|
|||||||
public class WorldTemplateProvider {
|
public class WorldTemplateProvider {
|
||||||
|
|
||||||
private static final WorldTemplateProvider instance = new WorldTemplateProvider();
|
private static final WorldTemplateProvider instance = new WorldTemplateProvider();
|
||||||
|
|
||||||
public static WorldTemplateProvider getInstance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final HashMap<String, WorldTemplate> templates = new HashMap<>();
|
private final HashMap<String, WorldTemplate> templates = new HashMap<>();
|
||||||
|
|
||||||
private WorldTemplateProvider() {
|
private WorldTemplateProvider() {
|
||||||
@ -49,6 +44,10 @@ public class WorldTemplateProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static WorldTemplateProvider getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
public WorldTemplate getTemplate(String key) {
|
public WorldTemplate getTemplate(String key) {
|
||||||
return templates.get(key);
|
return templates.get(key);
|
||||||
}
|
}
|
||||||
@ -62,7 +61,8 @@ public class WorldTemplateProvider {
|
|||||||
return null;
|
return null;
|
||||||
try {
|
try {
|
||||||
return World.Environment.valueOf(env);
|
return World.Environment.valueOf(env);
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,8 @@ public class WorldTemplateProvider {
|
|||||||
return null;
|
return null;
|
||||||
try {
|
try {
|
||||||
return WorldType.valueOf(type);
|
return WorldType.valueOf(type);
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,20 @@ import java.util.zip.GZIPOutputStream;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* bStats collects some data for plugin authors.
|
* bStats collects some data for plugin authors.
|
||||||
*
|
* <p>
|
||||||
* Check out https://bStats.org/ to learn more about bStats!
|
* Check out https://bStats.org/ to learn more about bStats!
|
||||||
*/
|
*/
|
||||||
public class Metrics {
|
public class Metrics {
|
||||||
|
|
||||||
|
// The version of this bStats class
|
||||||
|
public static final int B_STATS_VERSION = 1;
|
||||||
|
// The url to which the data is sent
|
||||||
|
private static final String URL = "https://bStats.org/submitData/bukkit";
|
||||||
|
// Should failed requests be logged?
|
||||||
|
private static boolean logFailedRequests;
|
||||||
|
// The uuid of the server
|
||||||
|
private static String serverUUID;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// You can use the property to disable the check in your test environment
|
// You can use the property to disable the check in your test environment
|
||||||
if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) {
|
if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) {
|
||||||
@ -43,18 +52,6 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The version of this bStats class
|
|
||||||
public static final int B_STATS_VERSION = 1;
|
|
||||||
|
|
||||||
// The url to which the data is sent
|
|
||||||
private static final String URL = "https://bStats.org/submitData/bukkit";
|
|
||||||
|
|
||||||
// Should failed requests be logged?
|
|
||||||
private static boolean logFailedRequests;
|
|
||||||
|
|
||||||
// The uuid of the server
|
|
||||||
private static String serverUUID;
|
|
||||||
|
|
||||||
// The plugin
|
// The plugin
|
||||||
private final JavaPlugin plugin;
|
private final JavaPlugin plugin;
|
||||||
|
|
||||||
@ -96,7 +93,8 @@ public class Metrics {
|
|||||||
).copyDefaults(true);
|
).copyDefaults(true);
|
||||||
try {
|
try {
|
||||||
config.save(configFile);
|
config.save(configFile);
|
||||||
} catch (IOException ignored) { }
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the data
|
// Load the data
|
||||||
@ -110,7 +108,8 @@ public class Metrics {
|
|||||||
service.getField("B_STATS_VERSION"); // Our identifier :)
|
service.getField("B_STATS_VERSION"); // Our identifier :)
|
||||||
found = true; // We aren't the first
|
found = true; // We aren't the first
|
||||||
break;
|
break;
|
||||||
} catch (NoSuchFieldException ignored) { }
|
} catch (NoSuchFieldException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Register our service
|
// Register our service
|
||||||
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
|
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
|
||||||
@ -121,161 +120,6 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a custom chart.
|
|
||||||
*
|
|
||||||
* @param chart The chart to add.
|
|
||||||
*/
|
|
||||||
public void addCustomChart(CustomChart chart) {
|
|
||||||
if (chart == null) {
|
|
||||||
throw new IllegalArgumentException("Chart cannot be null!");
|
|
||||||
}
|
|
||||||
charts.add(chart);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts the Scheduler which submits our data every 30 minutes.
|
|
||||||
*/
|
|
||||||
private void startSubmitting() {
|
|
||||||
final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags
|
|
||||||
timer.scheduleAtFixedRate(new TimerTask() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!plugin.isEnabled()) { // Plugin was disabled
|
|
||||||
timer.cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler
|
|
||||||
// Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;)
|
|
||||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
submitData();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 1000*60*5, 1000*60*30);
|
|
||||||
// Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start
|
|
||||||
// WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted!
|
|
||||||
// WARNING: Just don't do it!
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the plugin specific data.
|
|
||||||
* This method is called using Reflection.
|
|
||||||
*
|
|
||||||
* @return The plugin specific data.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public JSONObject getPluginData() {
|
|
||||||
JSONObject data = new JSONObject();
|
|
||||||
|
|
||||||
String pluginName = plugin.getDescription().getName();
|
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
|
||||||
|
|
||||||
data.put("pluginName", pluginName); // Append the name of the plugin
|
|
||||||
data.put("pluginVersion", pluginVersion); // Append the version of the plugin
|
|
||||||
JSONArray customCharts = new JSONArray();
|
|
||||||
for (CustomChart customChart : charts) {
|
|
||||||
// Add the data of the custom charts
|
|
||||||
JSONObject chart = customChart.getRequestJsonObject();
|
|
||||||
if (chart == null) { // If the chart is null, we skip it
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
customCharts.add(chart);
|
|
||||||
}
|
|
||||||
data.put("customCharts", customCharts);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the server specific data.
|
|
||||||
*
|
|
||||||
* @return The server specific data.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private JSONObject getServerData() {
|
|
||||||
// Minecraft specific data
|
|
||||||
int playerAmount;
|
|
||||||
try {
|
|
||||||
// Around MC 1.8 the return type was changed to a collection from an array,
|
|
||||||
// This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
|
|
||||||
Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
|
|
||||||
playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
|
|
||||||
? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
|
|
||||||
: ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
|
|
||||||
} catch (Exception e) {
|
|
||||||
playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
|
|
||||||
}
|
|
||||||
int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
|
|
||||||
String bukkitVersion = org.bukkit.Bukkit.getVersion();
|
|
||||||
bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);
|
|
||||||
|
|
||||||
// OS/Java specific data
|
|
||||||
String javaVersion = System.getProperty("java.version");
|
|
||||||
String osName = System.getProperty("os.name");
|
|
||||||
String osArch = System.getProperty("os.arch");
|
|
||||||
String osVersion = System.getProperty("os.version");
|
|
||||||
int coreCount = Runtime.getRuntime().availableProcessors();
|
|
||||||
|
|
||||||
JSONObject data = new JSONObject();
|
|
||||||
|
|
||||||
data.put("serverUUID", serverUUID);
|
|
||||||
|
|
||||||
data.put("playerAmount", playerAmount);
|
|
||||||
data.put("onlineMode", onlineMode);
|
|
||||||
data.put("bukkitVersion", bukkitVersion);
|
|
||||||
|
|
||||||
data.put("javaVersion", javaVersion);
|
|
||||||
data.put("osName", osName);
|
|
||||||
data.put("osArch", osArch);
|
|
||||||
data.put("osVersion", osVersion);
|
|
||||||
data.put("coreCount", coreCount);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Collects the data and sends it afterwards.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private void submitData() {
|
|
||||||
final JSONObject data = getServerData();
|
|
||||||
|
|
||||||
JSONArray pluginData = new JSONArray();
|
|
||||||
// Search for all other bStats Metrics classes to get their plugin data
|
|
||||||
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
|
|
||||||
try {
|
|
||||||
service.getField("B_STATS_VERSION"); // Our identifier :)
|
|
||||||
|
|
||||||
for (RegisteredServiceProvider<?> provider : Bukkit.getServicesManager().getRegistrations(service)) {
|
|
||||||
try {
|
|
||||||
pluginData.add(provider.getService().getMethod("getPluginData").invoke(provider.getProvider()));
|
|
||||||
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { }
|
|
||||||
}
|
|
||||||
} catch (NoSuchFieldException ignored) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
data.put("plugins", pluginData);
|
|
||||||
|
|
||||||
// Create a new thread for the connection to the bStats server
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
// Send the data
|
|
||||||
sendData(data);
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Something went wrong! :(
|
|
||||||
if (logFailedRequests) {
|
|
||||||
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends the data to the bStats server.
|
* Sends the data to the bStats server.
|
||||||
*
|
*
|
||||||
@ -331,6 +175,163 @@ public class Metrics {
|
|||||||
return outputStream.toByteArray();
|
return outputStream.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a custom chart.
|
||||||
|
*
|
||||||
|
* @param chart The chart to add.
|
||||||
|
*/
|
||||||
|
public void addCustomChart(CustomChart chart) {
|
||||||
|
if (chart == null) {
|
||||||
|
throw new IllegalArgumentException("Chart cannot be null!");
|
||||||
|
}
|
||||||
|
charts.add(chart);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts the Scheduler which submits our data every 30 minutes.
|
||||||
|
*/
|
||||||
|
private void startSubmitting() {
|
||||||
|
final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags
|
||||||
|
timer.scheduleAtFixedRate(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (!plugin.isEnabled()) { // Plugin was disabled
|
||||||
|
timer.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler
|
||||||
|
// Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;)
|
||||||
|
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
submitData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 1000 * 60 * 5, 1000 * 60 * 30);
|
||||||
|
// Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start
|
||||||
|
// WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted!
|
||||||
|
// WARNING: Just don't do it!
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the plugin specific data.
|
||||||
|
* This method is called using Reflection.
|
||||||
|
*
|
||||||
|
* @return The plugin specific data.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public JSONObject getPluginData() {
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
|
||||||
|
String pluginName = plugin.getDescription().getName();
|
||||||
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
|
|
||||||
|
data.put("pluginName", pluginName); // Append the name of the plugin
|
||||||
|
data.put("pluginVersion", pluginVersion); // Append the version of the plugin
|
||||||
|
JSONArray customCharts = new JSONArray();
|
||||||
|
for (CustomChart customChart : charts) {
|
||||||
|
// Add the data of the custom charts
|
||||||
|
JSONObject chart = customChart.getRequestJsonObject();
|
||||||
|
if (chart == null) { // If the chart is null, we skip it
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
customCharts.add(chart);
|
||||||
|
}
|
||||||
|
data.put("customCharts", customCharts);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the server specific data.
|
||||||
|
*
|
||||||
|
* @return The server specific data.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private JSONObject getServerData() {
|
||||||
|
// Minecraft specific data
|
||||||
|
int playerAmount;
|
||||||
|
try {
|
||||||
|
// Around MC 1.8 the return type was changed to a collection from an array,
|
||||||
|
// This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
|
||||||
|
Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
|
||||||
|
playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
|
||||||
|
? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
|
||||||
|
: ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
|
||||||
|
} catch (Exception e) {
|
||||||
|
playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
|
||||||
|
}
|
||||||
|
int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
|
||||||
|
String bukkitVersion = org.bukkit.Bukkit.getVersion();
|
||||||
|
bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);
|
||||||
|
|
||||||
|
// OS/Java specific data
|
||||||
|
String javaVersion = System.getProperty("java.version");
|
||||||
|
String osName = System.getProperty("os.name");
|
||||||
|
String osArch = System.getProperty("os.arch");
|
||||||
|
String osVersion = System.getProperty("os.version");
|
||||||
|
int coreCount = Runtime.getRuntime().availableProcessors();
|
||||||
|
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
|
||||||
|
data.put("serverUUID", serverUUID);
|
||||||
|
|
||||||
|
data.put("playerAmount", playerAmount);
|
||||||
|
data.put("onlineMode", onlineMode);
|
||||||
|
data.put("bukkitVersion", bukkitVersion);
|
||||||
|
|
||||||
|
data.put("javaVersion", javaVersion);
|
||||||
|
data.put("osName", osName);
|
||||||
|
data.put("osArch", osArch);
|
||||||
|
data.put("osVersion", osVersion);
|
||||||
|
data.put("coreCount", coreCount);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collects the data and sends it afterwards.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void submitData() {
|
||||||
|
final JSONObject data = getServerData();
|
||||||
|
|
||||||
|
JSONArray pluginData = new JSONArray();
|
||||||
|
// Search for all other bStats Metrics classes to get their plugin data
|
||||||
|
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
|
||||||
|
try {
|
||||||
|
service.getField("B_STATS_VERSION"); // Our identifier :)
|
||||||
|
|
||||||
|
for (RegisteredServiceProvider<?> provider : Bukkit.getServicesManager().getRegistrations(service)) {
|
||||||
|
try {
|
||||||
|
pluginData.add(provider.getService().getMethod("getPluginData").invoke(provider.getProvider()));
|
||||||
|
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (NoSuchFieldException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.put("plugins", pluginData);
|
||||||
|
|
||||||
|
// Create a new thread for the connection to the bStats server
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
// Send the data
|
||||||
|
sendData(data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Something went wrong! :(
|
||||||
|
if (logFailedRequests) {
|
||||||
|
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a custom chart.
|
* Represents a custom chart.
|
||||||
*/
|
*/
|
||||||
@ -352,7 +353,7 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private JSONObject getRequestJsonObject() {
|
private JSONObject getRequestJsonObject() {
|
||||||
JSONObject chart = new JSONObject();
|
JSONObject chart = new JSONObject();
|
||||||
chart.put("chartId", chartId);
|
chart.put("chartId", chartId);
|
||||||
try {
|
try {
|
||||||
@ -385,7 +386,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param chartId The id of the chart.
|
* @param chartId The id of the chart.
|
||||||
* @param callable The callable which is used to request the chart data.
|
* @param callable The callable which is used to request the chart data.
|
||||||
*/
|
*/
|
||||||
public SimplePie(String chartId, Callable<String> callable) {
|
public SimplePie(String chartId, Callable<String> callable) {
|
||||||
@ -394,7 +395,7 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected JSONObject getChartData() throws Exception {
|
protected JSONObject getChartData() throws Exception {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
String value = callable.call();
|
String value = callable.call();
|
||||||
@ -417,7 +418,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param chartId The id of the chart.
|
* @param chartId The id of the chart.
|
||||||
* @param callable The callable which is used to request the chart data.
|
* @param callable The callable which is used to request the chart data.
|
||||||
*/
|
*/
|
||||||
public AdvancedPie(String chartId, Callable<Map<String, Integer>> callable) {
|
public AdvancedPie(String chartId, Callable<Map<String, Integer>> callable) {
|
||||||
@ -426,7 +427,7 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected JSONObject getChartData() throws Exception {
|
protected JSONObject getChartData() throws Exception {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
JSONObject values = new JSONObject();
|
JSONObject values = new JSONObject();
|
||||||
@ -462,7 +463,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param chartId The id of the chart.
|
* @param chartId The id of the chart.
|
||||||
* @param callable The callable which is used to request the chart data.
|
* @param callable The callable which is used to request the chart data.
|
||||||
*/
|
*/
|
||||||
public DrilldownPie(String chartId, Callable<Map<String, Map<String, Integer>>> callable) {
|
public DrilldownPie(String chartId, Callable<Map<String, Map<String, Integer>>> callable) {
|
||||||
@ -471,7 +472,7 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getChartData() throws Exception {
|
public JSONObject getChartData() throws Exception {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
JSONObject values = new JSONObject();
|
JSONObject values = new JSONObject();
|
||||||
@ -512,7 +513,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param chartId The id of the chart.
|
* @param chartId The id of the chart.
|
||||||
* @param callable The callable which is used to request the chart data.
|
* @param callable The callable which is used to request the chart data.
|
||||||
*/
|
*/
|
||||||
public SingleLineChart(String chartId, Callable<Integer> callable) {
|
public SingleLineChart(String chartId, Callable<Integer> callable) {
|
||||||
@ -521,7 +522,7 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected JSONObject getChartData() throws Exception {
|
protected JSONObject getChartData() throws Exception {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
int value = callable.call();
|
int value = callable.call();
|
||||||
@ -545,7 +546,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param chartId The id of the chart.
|
* @param chartId The id of the chart.
|
||||||
* @param callable The callable which is used to request the chart data.
|
* @param callable The callable which is used to request the chart data.
|
||||||
*/
|
*/
|
||||||
public MultiLineChart(String chartId, Callable<Map<String, Integer>> callable) {
|
public MultiLineChart(String chartId, Callable<Map<String, Integer>> callable) {
|
||||||
@ -554,7 +555,7 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected JSONObject getChartData() throws Exception {
|
protected JSONObject getChartData() throws Exception {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
JSONObject values = new JSONObject();
|
JSONObject values = new JSONObject();
|
||||||
@ -591,7 +592,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param chartId The id of the chart.
|
* @param chartId The id of the chart.
|
||||||
* @param callable The callable which is used to request the chart data.
|
* @param callable The callable which is used to request the chart data.
|
||||||
*/
|
*/
|
||||||
public SimpleBarChart(String chartId, Callable<Map<String, Integer>> callable) {
|
public SimpleBarChart(String chartId, Callable<Map<String, Integer>> callable) {
|
||||||
@ -600,7 +601,7 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected JSONObject getChartData() throws Exception {
|
protected JSONObject getChartData() throws Exception {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
JSONObject values = new JSONObject();
|
JSONObject values = new JSONObject();
|
||||||
@ -630,7 +631,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param chartId The id of the chart.
|
* @param chartId The id of the chart.
|
||||||
* @param callable The callable which is used to request the chart data.
|
* @param callable The callable which is used to request the chart data.
|
||||||
*/
|
*/
|
||||||
public AdvancedBarChart(String chartId, Callable<Map<String, int[]>> callable) {
|
public AdvancedBarChart(String chartId, Callable<Map<String, int[]>> callable) {
|
||||||
@ -639,7 +640,7 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected JSONObject getChartData() throws Exception {
|
protected JSONObject getChartData() throws Exception {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
JSONObject values = new JSONObject();
|
JSONObject values = new JSONObject();
|
||||||
|
@ -19,7 +19,7 @@ worldtemplates:
|
|||||||
default: 'template_default'
|
default: 'template_default'
|
||||||
templates:
|
templates:
|
||||||
# The "1" can be any key
|
# The "1" can be any key
|
||||||
1:
|
1:
|
||||||
# Name of directory in plugins/WorldSystem/worldsources
|
# Name of directory in plugins/WorldSystem/worldsources
|
||||||
# e.g. this would be plugins/WorldSystem/worldsources/template_default
|
# e.g. this would be plugins/WorldSystem/worldsources/template_default
|
||||||
name: 'template_default'
|
name: 'template_default'
|
||||||
@ -68,7 +68,7 @@ database:
|
|||||||
# How the table with the saved player positions on the playerworlds should be named
|
# How the table with the saved player positions on the playerworlds should be named
|
||||||
worlds_table_name: worlds_positions
|
worlds_table_name: worlds_positions
|
||||||
# How the table with the saved player positions on the normal worlds should be named
|
# How the table with the saved player positions on the normal worlds should be named
|
||||||
players_table_name : player_positions
|
players_table_name: player_positions
|
||||||
# Configure here your mysql connection
|
# Configure here your mysql connection
|
||||||
mysql_settings:
|
mysql_settings:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
|
@ -13,7 +13,7 @@ world:
|
|||||||
delete:
|
delete:
|
||||||
own: ""
|
own: ""
|
||||||
other: "%player"
|
other: "%player"
|
||||||
does_not_exists:
|
does_not_exists:
|
||||||
own: ""
|
own: ""
|
||||||
other: ""
|
other: ""
|
||||||
setting_up: ""
|
setting_up: ""
|
||||||
@ -65,7 +65,7 @@ info:
|
|||||||
fire: "%data"
|
fire: "%data"
|
||||||
enabled: ""
|
enabled: ""
|
||||||
disabled: ""
|
disabled: ""
|
||||||
|
|
||||||
command_help:
|
command_help:
|
||||||
list:
|
list:
|
||||||
- ""
|
- ""
|
||||||
|
@ -64,7 +64,7 @@ info:
|
|||||||
fire: "Tuli: %data"
|
fire: "Tuli: %data"
|
||||||
enabled: "&aOn"
|
enabled: "&aOn"
|
||||||
disabled: "&cOff"
|
disabled: "&cOff"
|
||||||
|
|
||||||
command_help:
|
command_help:
|
||||||
list:
|
list:
|
||||||
- "/ws get &8- &7Luo sinulle maailman"
|
- "/ws get &8- &7Luo sinulle maailman"
|
||||||
|
@ -13,7 +13,7 @@ world:
|
|||||||
delete:
|
delete:
|
||||||
own: "&cA világot törölve!"
|
own: "&cA világot törölve!"
|
||||||
other: "Törölte a világot &c%player&6 játékostól!"
|
other: "Törölte a világot &c%player&6 játékostól!"
|
||||||
does_not_exists:
|
does_not_exists:
|
||||||
own: "&cNincs világod!"
|
own: "&cNincs világod!"
|
||||||
other: "&cEz a játékos nem rendelkezik világgal!"
|
other: "&cEz a játékos nem rendelkezik világgal!"
|
||||||
setting_up: "&aA világ megteremtése..."
|
setting_up: "&aA világ megteremtése..."
|
||||||
@ -65,7 +65,7 @@ info:
|
|||||||
fire: "Tûz: %data"
|
fire: "Tûz: %data"
|
||||||
enabled: "&aBe"
|
enabled: "&aBe"
|
||||||
disabled: "&cKi"
|
disabled: "&cKi"
|
||||||
|
|
||||||
command_help:
|
command_help:
|
||||||
list:
|
list:
|
||||||
- "/ws get &8- &7Will give you a world"
|
- "/ws get &8- &7Will give you a world"
|
||||||
|
@ -13,7 +13,7 @@ world:
|
|||||||
delete:
|
delete:
|
||||||
own: "&cJouw wereld is verwijderd!"
|
own: "&cJouw wereld is verwijderd!"
|
||||||
other: "Jij hebt de wereld verwijderd van: &c%player&6!"
|
other: "Jij hebt de wereld verwijderd van: &c%player&6!"
|
||||||
does_not_exists:
|
does_not_exists:
|
||||||
own: "&cJij hebt nog geen wereld!"
|
own: "&cJij hebt nog geen wereld!"
|
||||||
other: "&cDeze speler heeft nog geen wereld!"
|
other: "&cDeze speler heeft nog geen wereld!"
|
||||||
setting_up: "&aWereld word aangemaakt"
|
setting_up: "&aWereld word aangemaakt"
|
||||||
@ -64,7 +64,7 @@ info:
|
|||||||
fire: "Vuur: %data"
|
fire: "Vuur: %data"
|
||||||
enabled: "&Aan"
|
enabled: "&Aan"
|
||||||
disabled: "&cUit"
|
disabled: "&cUit"
|
||||||
|
|
||||||
command_help:
|
command_help:
|
||||||
list:
|
list:
|
||||||
- "/ws get &8- &7Will give you a world"
|
- "/ws get &8- &7Will give you a world"
|
||||||
|
@ -13,7 +13,7 @@ world:
|
|||||||
delete:
|
delete:
|
||||||
own: "&cTwój świat został skasowany!"
|
own: "&cTwój świat został skasowany!"
|
||||||
other: "Usunąłeś świat gracza: &c%player&6!"
|
other: "Usunąłeś świat gracza: &c%player&6!"
|
||||||
does_not_exists:
|
does_not_exists:
|
||||||
own: "&cNie masz swojego świata!"
|
own: "&cNie masz swojego świata!"
|
||||||
other: "&cTen gracz nie ma swojego świata!"
|
other: "&cTen gracz nie ma swojego świata!"
|
||||||
setting_up: "&aUstawianie świata..."
|
setting_up: "&aUstawianie świata..."
|
||||||
@ -64,7 +64,7 @@ info:
|
|||||||
fire: "Ogień: %data"
|
fire: "Ogień: %data"
|
||||||
enabled: "&aWłączone"
|
enabled: "&aWłączone"
|
||||||
disabled: "&cWyłączone"
|
disabled: "&cWyłączone"
|
||||||
|
|
||||||
command_help:
|
command_help:
|
||||||
list:
|
list:
|
||||||
- "/ws get &8- &7Tworzy Twój świat"
|
- "/ws get &8- &7Tworzy Twój świat"
|
||||||
|
@ -60,7 +60,7 @@ permissions:
|
|||||||
default: op
|
default: op
|
||||||
description: You can see lag messages
|
description: You can see lag messages
|
||||||
ws.big:
|
ws.big:
|
||||||
default: op
|
default: op
|
||||||
description: Gives you a bigger world (if set)
|
description: Gives you a bigger world (if set)
|
||||||
ws.large:
|
ws.large:
|
||||||
default: op
|
default: op
|
||||||
@ -70,5 +70,5 @@ permissions:
|
|||||||
ws.confirm:
|
ws.confirm:
|
||||||
default: op
|
default: op
|
||||||
description: You can confirm (if needed) an auto-update
|
description: You can confirm (if needed) an auto-update
|
||||||
|
|
||||||
default-permission: admin
|
default-permission: admin
|
@ -13,7 +13,7 @@ world:
|
|||||||
delete:
|
delete:
|
||||||
own: "&cТвой мир был удален!"
|
own: "&cТвой мир был удален!"
|
||||||
other: "Мир от &c%player&6 был удален!"
|
other: "Мир от &c%player&6 был удален!"
|
||||||
does_not_exists:
|
does_not_exists:
|
||||||
own: "&cУ тебя нету мира!"
|
own: "&cУ тебя нету мира!"
|
||||||
other: "&cУ этого игрока нету мира!"
|
other: "&cУ этого игрока нету мира!"
|
||||||
setting_up: "&aПриготовлеваю мир..."
|
setting_up: "&aПриготовлеваю мир..."
|
||||||
@ -64,7 +64,7 @@ info:
|
|||||||
fire: "Огонь: %data"
|
fire: "Огонь: %data"
|
||||||
enabled: "&aВключен"
|
enabled: "&aВключен"
|
||||||
disabled: "&cОтключен"
|
disabled: "&cОтключен"
|
||||||
|
|
||||||
command_help:
|
command_help:
|
||||||
list:
|
list:
|
||||||
- "/ws get &8- &7Даст тебе мир"
|
- "/ws get &8- &7Даст тебе мир"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Center will be at the spawn or the worldspawn
|
# Center will be at the spawn or the worldspawn
|
||||||
worldborder:
|
worldborder:
|
||||||
# If WorldSystem should change the worldborder
|
# If WorldSystem should change the worldborder
|
||||||
should_change: true
|
should_change: true
|
||||||
# Default size
|
# Default size
|
||||||
@ -10,7 +10,7 @@ worldborder:
|
|||||||
# For example, with the permission ws.big you will get a worldborder with the size 1000
|
# For example, with the permission ws.big you will get a worldborder with the size 1000
|
||||||
ws.big: 1000
|
ws.big: 1000
|
||||||
ws.bigger: 1500
|
ws.bigger: 1500
|
||||||
|
|
||||||
# Set a specialized center which is not the spawn
|
# Set a specialized center which is not the spawn
|
||||||
center:
|
center:
|
||||||
as_spawn: true
|
as_spawn: true
|
||||||
|
@ -13,7 +13,7 @@ world:
|
|||||||
delete:
|
delete:
|
||||||
own: "&c你的世界已删除!"
|
own: "&c你的世界已删除!"
|
||||||
other: "你删除了 &c%player &6的世界"
|
other: "你删除了 &c%player &6的世界"
|
||||||
does_not_exists:
|
does_not_exists:
|
||||||
own: "&c你没有世界!"
|
own: "&c你没有世界!"
|
||||||
other: "&c这个玩家没有世界!"
|
other: "&c这个玩家没有世界!"
|
||||||
setting_up: "&a正在建立世界..."
|
setting_up: "&a正在建立世界..."
|
||||||
@ -63,7 +63,7 @@ info:
|
|||||||
fire: "火: %data"
|
fire: "火: %data"
|
||||||
enabled: "&a开启"
|
enabled: "&a开启"
|
||||||
disabled: "&c关闭"
|
disabled: "&c关闭"
|
||||||
|
|
||||||
command_help:
|
command_help:
|
||||||
list:
|
list:
|
||||||
- "/ws get &8- &7创建一个世界"
|
- "/ws get &8- &7创建一个世界"
|
||||||
|
84
target/classes/custom.yml
Normal file
84
target/classes/custom.yml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
nopermission: ""
|
||||||
|
unknown_error: ""
|
||||||
|
lagdetection: "%world"
|
||||||
|
wrong_usage: ""
|
||||||
|
not_registered: ""
|
||||||
|
|
||||||
|
world:
|
||||||
|
reseted: ""
|
||||||
|
still_loaded: ""
|
||||||
|
not_on: ""
|
||||||
|
created: ""
|
||||||
|
already_exists: ""
|
||||||
|
delete:
|
||||||
|
own: ""
|
||||||
|
other: "%player"
|
||||||
|
does_not_exists:
|
||||||
|
own: ""
|
||||||
|
other: ""
|
||||||
|
setting_up: ""
|
||||||
|
playerlist: "%players"
|
||||||
|
still_creating: ""
|
||||||
|
set_home: ""
|
||||||
|
not_enough_money: ""
|
||||||
|
|
||||||
|
|
||||||
|
member:
|
||||||
|
removed: "%player"
|
||||||
|
added: "%player"
|
||||||
|
already_added: "
|
||||||
|
not_added:
|
||||||
|
own: ""
|
||||||
|
other: ""
|
||||||
|
no_one_added
|
||||||
|
|
||||||
|
request:
|
||||||
|
expired: ""
|
||||||
|
confirm: "%command"
|
||||||
|
until_expire: "%time"
|
||||||
|
already_sent: ""
|
||||||
|
not_sent: ""
|
||||||
|
invalid_input: "%input"
|
||||||
|
|
||||||
|
toggle:
|
||||||
|
gamemode:
|
||||||
|
enabled: ""
|
||||||
|
disabled: ""
|
||||||
|
teleport:
|
||||||
|
enabled: ""
|
||||||
|
disabled: ""
|
||||||
|
build:
|
||||||
|
enabled: ""
|
||||||
|
disabled: ""
|
||||||
|
fire:
|
||||||
|
enabled: ""
|
||||||
|
disabled: ""
|
||||||
|
tnt:
|
||||||
|
enabled: ""
|
||||||
|
disabled: ""
|
||||||
|
|
||||||
|
info:
|
||||||
|
owner: "%data"
|
||||||
|
id: "%data"
|
||||||
|
member: "%data"
|
||||||
|
tnt: "%data"
|
||||||
|
fire: "%data"
|
||||||
|
enabled: ""
|
||||||
|
disabled: ""
|
||||||
|
|
||||||
|
command_help:
|
||||||
|
list:
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
- ""
|
||||||
|
delete_command: ""
|
85
target/classes/fi.yml
Normal file
85
target/classes/fi.yml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
nopermission: "&cSinulla ei ole lupaa tuohon komentoon!"
|
||||||
|
unknown_error: "&cJotain meni pieleen..."
|
||||||
|
lagdetection: "Lagia havaittu maailmassa: &c%world"
|
||||||
|
wrong_usage: "&c%usage"
|
||||||
|
not_registered: "&cTämä pelaaja ei ole liittynyt vielä!"
|
||||||
|
|
||||||
|
world:
|
||||||
|
reseted: "Maailmasi nollautui!"
|
||||||
|
still_loaded: "&cMailmasi on vieläkin ladattu!"
|
||||||
|
not_on: "&cEt ole maailmassa!"
|
||||||
|
created: "Maailmasi on nyt valmis. Pääset sinne komennolla &a/ws home"
|
||||||
|
already_exists: "&cSinulla on jo maailma!"
|
||||||
|
delete:
|
||||||
|
own: "&cMaailmasi poistettiin!"
|
||||||
|
other: "Poistit pelaajan &c%player&6 maailman&6!"
|
||||||
|
does_not_exists:
|
||||||
|
own: "&cSinulla ei ole maailmaa!"
|
||||||
|
other: "&cKyseisellä pelaajalla ei ole maailmaa!"
|
||||||
|
setting_up: "&aAlustetaan maailmaa..."
|
||||||
|
playerlist: "Pelaajat tässä maailmassa: %players"
|
||||||
|
still_creating: "&cWorld is still creating"
|
||||||
|
set_home: "You set the home"
|
||||||
|
not_enough_money: "You do not have enough money"
|
||||||
|
|
||||||
|
member:
|
||||||
|
removed: "Poistit pelaajan &c%player&6 maailmastasi!"
|
||||||
|
added: "Lisäsit pelaajan &c%player&6 maailmaasi!"
|
||||||
|
already_added: "&cKyseinen pelaaja on jo jäsen!"
|
||||||
|
not_added:
|
||||||
|
own: "&cKyseinen pelaaja ei ole jäsen!"
|
||||||
|
other: "&cSinua ei ole lisätty tähän maailmaan"
|
||||||
|
no_one_added: "&cThere are no members added"
|
||||||
|
|
||||||
|
request:
|
||||||
|
expired: "&cPyyntösi on vanhentunut!"
|
||||||
|
confirm: "&cVahvista maailmasi nollaaminen: %command"
|
||||||
|
until_expire: "&cPyyntösi vanhentuu %time seconds sekunnin kuluttua!"
|
||||||
|
already_sent: "&cLähetit jo pyynnön!"
|
||||||
|
not_sent: "&cEt lähettänyt pyyntöä!"
|
||||||
|
invalid_input: "&cSyöte ei ole kelvollinen!"
|
||||||
|
|
||||||
|
toggle:
|
||||||
|
gamemode:
|
||||||
|
enabled: "&a%player&6 voi nyt vaihtaa pelimuotonsa!"
|
||||||
|
disabled: "&c%player&6 ei voi enää vaihtaa pelimuotoansa!"
|
||||||
|
teleport:
|
||||||
|
enabled: "&a%player&6 voi nyt teleportata!"
|
||||||
|
disabled: "&c%player&6 ei voi enään teleportata!"
|
||||||
|
build:
|
||||||
|
enabled: "&a%player&6 voi nyt rakentaa!"
|
||||||
|
disabled: "&c%player&6 ei voi enään rakentaa!"
|
||||||
|
fire:
|
||||||
|
enabled: "&aSinä aktivoit tulen!"
|
||||||
|
disabled: "&cSinä deaktivoit tulen!"
|
||||||
|
tnt:
|
||||||
|
enabled: "&aSinä aktivoit TNT-Damagen!"
|
||||||
|
disabled: "&cSinä deaktivoit TNT-Damagen!"
|
||||||
|
|
||||||
|
info:
|
||||||
|
owner: "Omistaja: %data"
|
||||||
|
id: "ID: %data"
|
||||||
|
member: "Jäsen: %data"
|
||||||
|
tnt: "TNT: %data"
|
||||||
|
fire: "Tuli: %data"
|
||||||
|
enabled: "&aOn"
|
||||||
|
disabled: "&cOff"
|
||||||
|
|
||||||
|
command_help:
|
||||||
|
list:
|
||||||
|
- "/ws get &8- &7Luo sinulle maailman"
|
||||||
|
- "/ws home &8- &7Teleporttaa sinut maailmaasi"
|
||||||
|
- "/ws sethome &8- &7Sets a specific home"
|
||||||
|
- "/ws gui &8- &7Avaa sinulle valikon jos omistat tämän maailman"
|
||||||
|
- "/ws tp &8- &7Teleporttaa sinut tiettyyn maailmaan"
|
||||||
|
- "/ws addmember &8- &7Lisää pelaajan sinun maailmaasi"
|
||||||
|
- "/ws delmember &8- &7Poistaa pelaajan sinun maailmastasi"
|
||||||
|
- "/ws leave &8- &7Lähtee maailmasta"
|
||||||
|
- "/ws tnt &8- &7Sallii/Kieltää TNT sinun maailmastasi"
|
||||||
|
- "/ws fire &8- &7Sallii/Kieltää Tulen sinun maailmastasi"
|
||||||
|
- "/ws togglegm &8- &7Sallii/Kieltää pelaajan vaihtamasta pelimuotoansa"
|
||||||
|
- "/ws togglebuild &8- &7Sallii/Kieltää pelaajan rakentamasta"
|
||||||
|
- "/ws toggletp &8- &7Sallii/Kieltää pelaajan treleporttaamasta"
|
||||||
|
- "/ws info &8- &7Näyttää tietoa aktiivisesta maailmasta"
|
||||||
|
- "/ws reset &8- &7Nollaa sinun maailmasi"
|
||||||
|
delete_command: "/ws delete &8- &7Poistaa maailman"
|
85
target/classes/nl.yml
Normal file
85
target/classes/nl.yml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
nopermission: "&cJij hebt geen rechten om dit te doen!"
|
||||||
|
unknown_error: "&cEr is iets verkeerd gegaan.."
|
||||||
|
lagdetection: "Lag gededecteerd in wereld: &c%world"
|
||||||
|
wrong_usage: "&c%gebruik"
|
||||||
|
not_registered: "&cDeze speler heeft nog nooit gejoined!"
|
||||||
|
|
||||||
|
world:
|
||||||
|
reseted: "Jouw wereld is gereset!"
|
||||||
|
still_loaded: "&cJouw wereld is nog steeds geladen!"
|
||||||
|
not_on: "&cJij bent niet in een wereld!"
|
||||||
|
created: "Jouw wereld is gemaakt gebruik: &a/ws home"
|
||||||
|
already_exists: "&cJij hebt al een wereld!"
|
||||||
|
delete:
|
||||||
|
own: "&cJouw wereld is verwijderd!"
|
||||||
|
other: "Jij hebt de wereld verwijderd van: &c%player&6!"
|
||||||
|
does_not_exists:
|
||||||
|
own: "&cJij hebt nog geen wereld!"
|
||||||
|
other: "&cDeze speler heeft nog geen wereld!"
|
||||||
|
setting_up: "&aWereld word aangemaakt"
|
||||||
|
playerlist: "speler is in wereld: %players"
|
||||||
|
still_creating: "&cWorld is still creating"
|
||||||
|
set_home: "You set the home"
|
||||||
|
not_enough_money: "You do not have enough money"
|
||||||
|
|
||||||
|
member:
|
||||||
|
removed: "Jij hebt &c%player&6 verwijderd van jouw wereld!"
|
||||||
|
added: "Jij hebt &c%player&6 toegevoegd aan jouw wereld!"
|
||||||
|
already_added: "&cDeze speler is al toegevoegd!"
|
||||||
|
not_added:
|
||||||
|
own: "&cDeze speler is nog niet toegevoegd!"
|
||||||
|
other: "&cJij bent niet aan deze wereld toegevoegd"
|
||||||
|
no_one_added: "&cThere are no members added"
|
||||||
|
|
||||||
|
request:
|
||||||
|
expired: "&cJouw uitnodiging is verlopen!"
|
||||||
|
confirm: "&cBevestig het verwijderen van jouw wereld: %command"
|
||||||
|
until_expire: "&cJouw uitnodiging verloopt over %time seconden!"
|
||||||
|
already_sent: "&cJij hebt al een uitnodiging verstuurd!"
|
||||||
|
not_sent: "&cJij hebt geen uitnodiging gestuurd!"
|
||||||
|
invalid_input: "&c%input is niet een command!"
|
||||||
|
|
||||||
|
toggle:
|
||||||
|
gamemode:
|
||||||
|
enabled: "&a%player&6 kan nu zijn spelermodus veranderen!"
|
||||||
|
disabled: "&c%player&6 kan niet meer zijn spelermodus veranderen!"
|
||||||
|
teleport:
|
||||||
|
enabled: "&a%player&6 kan nu teleporteren!"
|
||||||
|
disabled: "&c%player&6 kan nu niet meer teleporteren!"
|
||||||
|
build:
|
||||||
|
enabled: "&a%player&6 kan nu bouwen!"
|
||||||
|
disabled: "&c%player&6 kan nu niet meer bouwen!"
|
||||||
|
fire:
|
||||||
|
enabled: "&aJij hebt vuur geactiveert!"
|
||||||
|
disabled: "&cJij hebt vuur gedeactiveerd!"
|
||||||
|
tnt:
|
||||||
|
enabled: "&aJij hebt TNT-schade geactiveerd!"
|
||||||
|
disabled: "&cJij hebt TNT-schade gedeactiveerd!"
|
||||||
|
|
||||||
|
info:
|
||||||
|
owner: "Owner: %data"
|
||||||
|
id: "ID: %data"
|
||||||
|
member: "Toegevoegd: %data"
|
||||||
|
tnt: "TNT: %data"
|
||||||
|
fire: "Vuur: %data"
|
||||||
|
enabled: "&Aan"
|
||||||
|
disabled: "&cUit"
|
||||||
|
|
||||||
|
command_help:
|
||||||
|
list:
|
||||||
|
- "/ws get &8- &7Will give you a world"
|
||||||
|
- "/ws home &8- &7Teleports you on your world"
|
||||||
|
- "/ws sethome &8- &7Sets a specific home"
|
||||||
|
- "/ws gui &8- &7Opens the GUI menu if you are the worldowner"
|
||||||
|
- "/ws tp &8- &7Teleports you on a specific world"
|
||||||
|
- "/ws addmember &8- &7Adds a player to your world"
|
||||||
|
- "/ws delmember &8- &7Removes a player from your world"
|
||||||
|
- "/ws leave &8- &7Leave a world"
|
||||||
|
- "/ws tnt &8- &7Allows/Denys TNT on your world"
|
||||||
|
- "/ws fire &8- &7Allows/Denys Fire on your world"
|
||||||
|
- "/ws togglegm &8- &7Allows/Denys a player changing gamemode"
|
||||||
|
- "/ws togglebuild &8- &7Allows/Denys a player building"
|
||||||
|
- "/ws toggletp &8- &7Allows/Denys a player teleporting"
|
||||||
|
- "/ws info &8- &7Shows information about the world"
|
||||||
|
- "/ws reset &8- &7Will reset your world"
|
||||||
|
delete_command: "/ws delete &8- &7Will delete a world"
|
85
target/classes/pl.yml
Normal file
85
target/classes/pl.yml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
nopermission: "&cNie posiadasz uprawnień do tego!"
|
||||||
|
unknown_error: "&cCoś poszło nie tak..."
|
||||||
|
lagdetection: "Wykryto laga na świecie: &c%world"
|
||||||
|
wrong_usage: "&c%usage"
|
||||||
|
not_registered: "&cTen gracz nie dołączył jeszcze na serwer!"
|
||||||
|
|
||||||
|
world:
|
||||||
|
reseted: "Twój świat został zresetowany!"
|
||||||
|
still_loaded: "&cTwój serwer wciąż się ładuje!"
|
||||||
|
not_on: "&cNie jesteś na swoim świecie!"
|
||||||
|
created: "Twój świat jest gotowy. Dostań się na niego za pomocą &a/ws home"
|
||||||
|
already_exists: "&cJuż posiadasz swój świat!"
|
||||||
|
delete:
|
||||||
|
own: "&cTwój świat został skasowany!"
|
||||||
|
other: "Usunąłeś świat gracza: &c%player&6!"
|
||||||
|
does_not_exists:
|
||||||
|
own: "&cNie masz swojego świata!"
|
||||||
|
other: "&cTen gracz nie ma swojego świata!"
|
||||||
|
setting_up: "&aUstawianie świata..."
|
||||||
|
playerlist: "Gracze na tym świecie: %players"
|
||||||
|
still_creating: "&cWorld is still creating"
|
||||||
|
set_home: "You set the home"
|
||||||
|
not_enough_money: "You do not have enough money"
|
||||||
|
|
||||||
|
member:
|
||||||
|
removed: "Usunąłeś &c%player&6 ze swojego świata!"
|
||||||
|
added: "Dodałeś &c%player&6 na swój świat!"
|
||||||
|
already_added: "&cTen gracz jest już dodany na Twoim świecie!"
|
||||||
|
not_added:
|
||||||
|
own: "&cTen gracz nie jest dodany do Twojego świata!"
|
||||||
|
other: "&cNie jesteś dodany na ten świat!"
|
||||||
|
no_one_added: "&cThere are no members added"
|
||||||
|
|
||||||
|
request:
|
||||||
|
expired: "&cTwoja prośba wygasła!"
|
||||||
|
confirm: "&cPotwierdź zresetowanie swojego świata komendą: %command"
|
||||||
|
until_expire: "&cTwója prośba wygaśnie za %time sek.!"
|
||||||
|
already_sent: "&cJuż wysłałeś prośbę!"
|
||||||
|
not_sent: "&cNie wysłałeś prośby!"
|
||||||
|
invalid_input: "&c%input nie jest poprawnym argumentem komendy!"
|
||||||
|
|
||||||
|
toggle:
|
||||||
|
gamemode:
|
||||||
|
enabled: "&a%player&6 może teraz zmienić swój gamemode!"
|
||||||
|
disabled: "&c%player&6 nie może już zmienić swojego gamemode!"
|
||||||
|
teleport:
|
||||||
|
enabled: "&a%player&6 może teleportować się!"
|
||||||
|
disabled: "&c%player&6 nie może teleportować się!"
|
||||||
|
build:
|
||||||
|
enabled: "&a%player&6 może budować!"
|
||||||
|
disabled: "&c%player&6 nie może już budować!"
|
||||||
|
fire:
|
||||||
|
enabled: "&aWłączyłeś ogień!"
|
||||||
|
disabled: "&cWyłączyłeś ogień!"
|
||||||
|
tnt:
|
||||||
|
enabled: "&aWłączyłeś obrażenia od TNT!"
|
||||||
|
disabled: "&cWyłączyłeś obrażenia od TNT!"
|
||||||
|
|
||||||
|
info:
|
||||||
|
owner: "Właściciel: %data"
|
||||||
|
id: "ID: %data"
|
||||||
|
member: "Członek: %data"
|
||||||
|
tnt: "TNT: %data"
|
||||||
|
fire: "Ogień: %data"
|
||||||
|
enabled: "&aWłączone"
|
||||||
|
disabled: "&cWyłączone"
|
||||||
|
|
||||||
|
command_help:
|
||||||
|
list:
|
||||||
|
- "/ws get &8- &7Tworzy Twój świat"
|
||||||
|
- "/ws home &8- &7Teleportuje Cie na Twój świat"
|
||||||
|
- "/ws sethome &8- &7Sets a specific home"
|
||||||
|
- "/ws gui &8- &7Otwiera GUI świata jeżeli jesteś jego właścicielem"
|
||||||
|
- "/ws tp &8- &7Teleportuje Cie na określony świat"
|
||||||
|
- "/ws addmember &8- &7Dodaj gracza na swój świat"
|
||||||
|
- "/ws delmember &8- &7Usuń gracza ze swojego świata"
|
||||||
|
- "/ws leave &8- &7Opuść świat"
|
||||||
|
- "/ws tnt &8- &7Zezwól/Odmów TNT na swoim świecie"
|
||||||
|
- "/ws fire &8- &7Zezwól/Odmów Ogień na swoim świecie"
|
||||||
|
- "/ws togglegm &8- &7Zezwól/Odmów graczowi zmieniać swój gamemode"
|
||||||
|
- "/ws togglebuild &8- &7Zezwól/Odmów graczowi budowanie"
|
||||||
|
- "/ws toggletp &8- &7Zezwól/Odmów graczowi teleportowanie się"
|
||||||
|
- "/ws info &8- &7Pokazuje informacje o świecie"
|
||||||
|
- "/ws reset &8- &7Zresetuje Twój świat"
|
||||||
|
delete_command: "/ws delete &8- &7Usunie Twój świat"
|
84
target/classes/ru.yml
Normal file
84
target/classes/ru.yml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
nopermission: "&cУ тебя нет прав!"
|
||||||
|
unknown_error: "&cЧего-то не удалось..."
|
||||||
|
lagdetection: "Лагов в мире: &c%world"
|
||||||
|
wrong_usage: "&c%usage"
|
||||||
|
not_registered: "&cЭтот игрок играет первый раз га этом сервере"
|
||||||
|
|
||||||
|
world:
|
||||||
|
reseted: "Твой мир был возвращен!"
|
||||||
|
still_loaded: "&cТвой мир ещё загружен!"
|
||||||
|
not_on: "&cТебя нету в не каком мире!"
|
||||||
|
created: "Твой мир готов. Используй &a/ws home"
|
||||||
|
already_exists: "&cТакой мир уже существует!"
|
||||||
|
delete:
|
||||||
|
own: "&cТвой мир был удален!"
|
||||||
|
other: "Мир от &c%player&6 был удален!"
|
||||||
|
does_not_exists:
|
||||||
|
own: "&cУ тебя нету мира!"
|
||||||
|
other: "&cУ этого игрока нету мира!"
|
||||||
|
setting_up: "&aПриготовлеваю мир..."
|
||||||
|
playerlist: "Игроков в мире: %players"
|
||||||
|
still_creating: "&cWorld is still creating"
|
||||||
|
set_home: "You set the home"
|
||||||
|
not_enough_money: "You do not have enough money"
|
||||||
|
|
||||||
|
member:
|
||||||
|
removed: "Ты удалил &c%player&6 из твоего мира!"
|
||||||
|
added: "Ты добавил &c%player&6 к твоему миру!"
|
||||||
|
already_added: "&cЭтот игрок уже член твоего мира!"
|
||||||
|
not_added:
|
||||||
|
own: "&cЭтот игрок не член твоего мира!"
|
||||||
|
other: "&cТебя не добавили к этому миру"
|
||||||
|
no_one_added: "&cThere are no members added"
|
||||||
|
|
||||||
|
request:
|
||||||
|
expired: "&cТвой запрос вытек!"
|
||||||
|
confirm: "&Подтверди сброс: %command"
|
||||||
|
until_expire: "&cТвой запрос вытечет через %time секунды!"
|
||||||
|
already_sent: "&cТы уже послал запрос!"
|
||||||
|
not_sent: "&cТы не послал запрос!"
|
||||||
|
invalid_input: "&c%input не действительный запрос!"
|
||||||
|
|
||||||
|
toggle:
|
||||||
|
gamemode:
|
||||||
|
enabled: "&a%player&6 теперь может изменить свой режим игры!"
|
||||||
|
disabled: "&c%player&6 не может больше изменить свой режим игры!"
|
||||||
|
teleport:
|
||||||
|
enabled: "&a%player&6 теперь может телепортироваться!"
|
||||||
|
disabled: "&c%player&6 не может больше телепортироваться!"
|
||||||
|
build:
|
||||||
|
enabled: "&a%player&6 может теперь строить!"
|
||||||
|
disabled: "&c%player&6 не может больше строить!"
|
||||||
|
fire:
|
||||||
|
enabled: "&aОгонь включен!"
|
||||||
|
disabled: "&cОгонь отключен"
|
||||||
|
tnt:
|
||||||
|
enabled: "&aПовреждение через ТНТ включено!"
|
||||||
|
disabled: "&cПовреждение через ТНТ отключено!"
|
||||||
|
|
||||||
|
info:
|
||||||
|
owner: "Владелец: %data"
|
||||||
|
id: "ID: %data"
|
||||||
|
member: "Члены: %data"
|
||||||
|
tnt: "ТНТ: %data"
|
||||||
|
fire: "Огонь: %data"
|
||||||
|
enabled: "&aВключен"
|
||||||
|
disabled: "&cОтключен"
|
||||||
|
|
||||||
|
command_help:
|
||||||
|
list:
|
||||||
|
- "/ws get &8- &7Даст тебе мир"
|
||||||
|
- "/ws home &8- &7Телепортирует тебя в твой мир"
|
||||||
|
- "/ws sethome &8- &7Sets a specific home"
|
||||||
|
- "/ws gui &8- &7Открывает ГИП если ты владелец этого мира"
|
||||||
|
- "/ws tp &8- &7Телепортирует тебя в определенный мир"
|
||||||
|
- "/ws addmember &8- &7Добавляет кого-то к твоему миру"
|
||||||
|
- "/ws delmember&8 - &7Удаляет кого-то из твоего мира"
|
||||||
|
- "/ws tnt &8- &7Разрешает/Запрещает TНT на твоем мире"
|
||||||
|
- "/ws fire &8- &7Разрешает/Запрещает огонь в твоем мире"
|
||||||
|
- "/ws togglegm &8- &7Разрешает/Запрещает игроку менять режим игры"
|
||||||
|
- "/ws togglebuild &8- &7Разрешает/Запрещает игроку строить"
|
||||||
|
- "/ws toggletp &8- &7Разрешает/Запрещает игроку телепортироваться"
|
||||||
|
- "/ws info &8- &7Показывает информацию про мир"
|
||||||
|
- "/ws reset &8- &7Сбрасывает твой мир"
|
||||||
|
delete_command: "/ws delete &8- &7Удалает твой мир"
|
62
target/classes/settings.yml
Normal file
62
target/classes/settings.yml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
# Center will be at the spawn or the worldspawn
|
||||||
|
worldborder:
|
||||||
|
# If WorldSystem should change the worldborder
|
||||||
|
should_change: true
|
||||||
|
# Default size
|
||||||
|
normal: 500
|
||||||
|
# Here you can define your own ranks, as many as you want
|
||||||
|
# The permission node will be the key and the value the size
|
||||||
|
ranks:
|
||||||
|
# For example, with the permission ws.big you will get a worldborder with the size 1000
|
||||||
|
ws.big: 1000
|
||||||
|
ws.bigger: 1500
|
||||||
|
|
||||||
|
# Set a specialized center which is not the spawn
|
||||||
|
center:
|
||||||
|
as_spawn: true
|
||||||
|
# Should the worldborder move with the home set by the owner
|
||||||
|
as_home: false
|
||||||
|
x: 0
|
||||||
|
y: 20
|
||||||
|
z: 0
|
||||||
|
|
||||||
|
difficulty: EASY
|
||||||
|
|
||||||
|
|
||||||
|
# Commands that should be executed on /ws get when it is ready
|
||||||
|
# Placeholders: %player: Name of player, %world: Name of world, %uuid: UUID of player
|
||||||
|
commands_on_get:
|
||||||
|
#- tell %player You have got a world
|
||||||
|
#- tell %player You are now on %world
|
||||||
|
|
||||||
|
|
||||||
|
# All Gamerules in 1.12
|
||||||
|
# Not supported gamerules will be ignored
|
||||||
|
#
|
||||||
|
# If you need help, look at
|
||||||
|
# https://minecraft.gamepedia.com/Commands/gamerule
|
||||||
|
|
||||||
|
announceAdvancements: true
|
||||||
|
commandBlockOutput: false
|
||||||
|
disableElytraMovementCheck: false
|
||||||
|
doDaylightCycle: true
|
||||||
|
doEntityDrops: true
|
||||||
|
doFireTick: true
|
||||||
|
doLimitedCrafting: false
|
||||||
|
doMobLoot: true
|
||||||
|
doMobSpawning: true
|
||||||
|
doTileDrops: true
|
||||||
|
doWeatherCycle: false
|
||||||
|
gameLoopFunction: false
|
||||||
|
keepInventory: true
|
||||||
|
logAdminCommands: true
|
||||||
|
maxCommandChainLength: 65536
|
||||||
|
maxEntityCramming: 24
|
||||||
|
mobGriefing: true
|
||||||
|
naturalRegeneration: true
|
||||||
|
randomTickSpeed: 3
|
||||||
|
reducedDebugInfo: false
|
||||||
|
sendCommandFeedback: true
|
||||||
|
showDeathMessages: true
|
||||||
|
spawnRadius: 10
|
||||||
|
spectatorsGenerateChunks: true
|
84
target/classes/zh.yml
Normal file
84
target/classes/zh.yml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
nopermission: "&c你没有权限!"
|
||||||
|
unknown_error: "&c出错..."
|
||||||
|
lagdetection: "滞后: &c%world"
|
||||||
|
wrong_usage: "&c%usage"
|
||||||
|
not_registered: "&c该玩家未在线!"
|
||||||
|
|
||||||
|
world:
|
||||||
|
reseted: "你的世界已重置!"
|
||||||
|
still_loaded: "&c你的世界正在加载!"
|
||||||
|
not_on: "&c你未在世界里!"
|
||||||
|
created: "你的世界已准备就绪,输入 &a/ws home &6前往"
|
||||||
|
already_exists: "&c你已拥有一个世界!"
|
||||||
|
delete:
|
||||||
|
own: "&c你的世界已删除!"
|
||||||
|
other: "你删除了 &c%player &6的世界"
|
||||||
|
does_not_exists:
|
||||||
|
own: "&c你没有世界!"
|
||||||
|
other: "&c这个玩家没有世界!"
|
||||||
|
setting_up: "&a正在建立世界..."
|
||||||
|
playerlist: "玩家: %players 在这个世界上"
|
||||||
|
still_creating: "&cWorld is still creating"
|
||||||
|
set_home: "You set the home"
|
||||||
|
not_enough_money: "You do not have enough money"
|
||||||
|
|
||||||
|
member:
|
||||||
|
removed: "玩家 &c%player&6 从你的世界移除!"
|
||||||
|
added: "你添加 &c%player&6 到你的世界!"
|
||||||
|
already_added: "&c这个玩家已经在你的世界里了!"
|
||||||
|
not_added:
|
||||||
|
own: "&c该玩家未在你的世界里!"
|
||||||
|
other: "&c你未加入这个世界"
|
||||||
|
|
||||||
|
request:
|
||||||
|
expired: "&c确认超时!"
|
||||||
|
confirm: "&c请确认,重置你的世界: %command"
|
||||||
|
until_expire: "&c请在 %time 秒,内确认!"
|
||||||
|
already_sent: "&c你已发送请求!"
|
||||||
|
not_sent: "&c你未发送请求!"
|
||||||
|
invalid_input: "&c%input 错误!"
|
||||||
|
|
||||||
|
toggle:
|
||||||
|
gamemode:
|
||||||
|
enabled: "&a%player&6 可以改变游戏模式!"
|
||||||
|
disabled: "&c%player&6 不能游戏模式!"
|
||||||
|
teleport:
|
||||||
|
enabled: "&a%player&6 可以传送!"
|
||||||
|
disabled: "&c%player&6 不能传送!"
|
||||||
|
build:
|
||||||
|
enabled: "&a%player&6 可以建筑!"
|
||||||
|
disabled: "&c%player&6 不能建筑!"
|
||||||
|
fire:
|
||||||
|
enabled: "&a你开启了 火!"
|
||||||
|
disabled: "&c你禁用了 火!"
|
||||||
|
tnt:
|
||||||
|
enabled: "&a你开启了 TNT-爆炸!"
|
||||||
|
disabled: "&c你禁用了 TNT-爆炸!"
|
||||||
|
|
||||||
|
info:
|
||||||
|
owner: "管理者: %data"
|
||||||
|
id: "ID: %data"
|
||||||
|
member: "成员: %data"
|
||||||
|
tnt: "TNT: %data"
|
||||||
|
fire: "火: %data"
|
||||||
|
enabled: "&a开启"
|
||||||
|
disabled: "&c关闭"
|
||||||
|
|
||||||
|
command_help:
|
||||||
|
list:
|
||||||
|
- "/ws get &8- &7创建一个世界"
|
||||||
|
- "/ws home &8- &7返回你的世界"
|
||||||
|
- "/ws sethome &8- &7Sets a specific home"
|
||||||
|
- "/ws gui &8- &7如果你是世界管理者,使用该指令打开菜单"
|
||||||
|
- "/ws tp &8- &7传送到指定世界"
|
||||||
|
- "/ws addmember &8- &7添加一个玩家到你的世界"
|
||||||
|
- "/ws delmember &8- &7将一个玩家从你的世界删除"
|
||||||
|
- "/ws leave &8- &7离开一个世界"
|
||||||
|
- "/ws tnt &8- &7开启/禁用 TNT爆炸"
|
||||||
|
- "/ws fire &8- &7开启/禁用,火"
|
||||||
|
- "/ws togglegm &8- &7开启/禁用,玩家切换模式"
|
||||||
|
- "/ws togglebuild &8- &7开启/禁用,玩家建筑"
|
||||||
|
- "/ws toggletp &8- &7开启/禁用,玩家传送"
|
||||||
|
- "/ws info &8- &7查看世界信息"
|
||||||
|
- "/ws reset &8- &7重置你的世界"
|
||||||
|
delete_command: "/ws delete &8- &7删除一个世界"
|
@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd"
|
||||||
|
version="3.0" name="de.butzlabben.world.wrapper.GeneratorSettingsTest" time="0.02" tests="1" errors="0"
|
||||||
|
skipped="0" failures="0">
|
||||||
|
<properties>
|
||||||
|
<property name="sun.desktop" value="windows"/>
|
||||||
|
<property name="awt.toolkit" value="sun.awt.windows.WToolkit"/>
|
||||||
|
<property name="file.encoding.pkg" value="sun.io"/>
|
||||||
|
<property name="java.specification.version" value="1.8"/>
|
||||||
|
<property name="sun.cpu.isalist" value="amd64"/>
|
||||||
|
<property name="sun.jnu.encoding" value="Cp1252"/>
|
||||||
|
<property name="java.class.path"
|
||||||
|
value="C:\Users\Daniel\IdeaProjects\worldsystem\target\test-classes;C:\Users\Daniel\IdeaProjects\worldsystem\target\classes;C:\Users\Daniel\.m2\repository\org\spigotmc\spigot-api\1.14-R0.1-SNAPSHOT\spigot-api-1.14-R0.1-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\Daniel\.m2\repository\com\google\guava\guava\21.0\guava-21.0.jar;C:\Users\Daniel\.m2\repository\com\google\code\gson\gson\2.8.0\gson-2.8.0.jar;C:\Users\Daniel\.m2\repository\net\md-5\bungeecord-chat\1.13-SNAPSHOT\bungeecord-chat-1.13-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;C:\Users\Daniel\.m2\repository\com\mojang\authlib\1.5.21\authlib-1.5.21.jar;C:\Users\Daniel\.m2\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;C:\Users\Daniel\.m2\repository\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;C:\Users\Daniel\.m2\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\Daniel\.m2\repository\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;C:\Users\Daniel\.m2\repository\com\google\code\findbugs\jsr305\2.0.1\jsr305-2.0.1.jar;C:\Users\Daniel\.m2\repository\commons-io\commons-io\2.6\commons-io-2.6.jar;C:\Users\Daniel\IdeaProjects\worldsystem\lib\FastAsyncWorldEdit.jar;C:\Users\Daniel\.m2\repository\com\sk89q\worldedit\worldedit-core\7.0.0-SNAPSHOT\worldedit-core-7.0.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\com\sk89q\worldedit\worldedit-libs\core\7.0.0-SNAPSHOT\core-7.0.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\de\schlichtherle\truezip\6.8.3\truezip-6.8.3.jar;C:\Users\Daniel\.m2\repository\rhino\js\1.7R2\js-1.7R2.jar;C:\Users\Daniel\.m2\repository\com\googlecode\json-simple\json-simple\1.1.1\json-simple-1.1.1.jar;C:\Users\Daniel\.m2\repository\junit\junit\4.10\junit-4.10.jar;C:\Users\Daniel\.m2\repository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar;C:\Users\Daniel\.m2\repository\org\slf4j\slf4j-api\1.7.26\slf4j-api-1.7.26.jar;C:\Users\Daniel\.m2\repository\com\sk89q\worldedit\worldedit-bukkit\7.0.0-SNAPSHOT\worldedit-bukkit-7.0.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\com\sk89q\worldedit\worldedit-libs\bukkit\7.0.0-SNAPSHOT\bukkit-7.0.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\org\bukkit\bukkit\1.13.2-R0.1-SNAPSHOT\bukkit-1.13.2-R0.1-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\io\papermc\paperlib\1.0.2\paperlib-1.0.2.jar;C:\Users\Daniel\.m2\repository\org\apache\logging\log4j\log4j-slf4j-impl\2.8.1\log4j-slf4j-impl-2.8.1.jar;C:\Users\Daniel\.m2\repository\org\bstats\bstats-bukkit\1.4\bstats-bukkit-1.4.jar;C:\Users\Daniel\.m2\repository\net\myplayplanet\CommandFramework\2.0.0-SNAPSHOT\CommandFramework-2.0.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\net\milkbowl\vault\VaultAPI\1.6\VaultAPI-1.6.jar;C:\Users\Daniel\.m2\repository\me\clip\placeholderapi\2.10.3\placeholderapi-2.10.3.jar;C:\Users\Daniel\.m2\repository\org\projectlombok\lombok\1.18.4\lombok-1.18.4.jar;"/>
|
||||||
|
<property name="java.vm.vendor" value="Oracle Corporation"/>
|
||||||
|
<property name="sun.arch.data.model" value="64"/>
|
||||||
|
<property name="user.variant" value=""/>
|
||||||
|
<property name="java.vendor.url" value="http://java.oracle.com/"/>
|
||||||
|
<property name="user.timezone" value="Europe/Berlin"/>
|
||||||
|
<property name="java.vm.specification.version" value="1.8"/>
|
||||||
|
<property name="os.name" value="Windows 10"/>
|
||||||
|
<property name="user.country" value="DE"/>
|
||||||
|
<property name="sun.java.launcher" value="SUN_STANDARD"/>
|
||||||
|
<property name="sun.boot.library.path" value="C:\Program Files\Java\jdk1.8.0_201\jre\bin"/>
|
||||||
|
<property name="sun.java.command"
|
||||||
|
value="C:\Users\Daniel\AppData\Local\Temp\surefire3643665927397989820\surefirebooter3807952172248991728.jar C:\Users\Daniel\AppData\Local\Temp\surefire3643665927397989820 2019-08-07T14-51-43_340-jvmRun1 surefire1354462544834427791tmp surefire_05685339790800404168tmp"/>
|
||||||
|
<property name="surefire.test.class.path"
|
||||||
|
value="C:\Users\Daniel\IdeaProjects\worldsystem\target\test-classes;C:\Users\Daniel\IdeaProjects\worldsystem\target\classes;C:\Users\Daniel\.m2\repository\org\spigotmc\spigot-api\1.14-R0.1-SNAPSHOT\spigot-api-1.14-R0.1-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\Daniel\.m2\repository\com\google\guava\guava\21.0\guava-21.0.jar;C:\Users\Daniel\.m2\repository\com\google\code\gson\gson\2.8.0\gson-2.8.0.jar;C:\Users\Daniel\.m2\repository\net\md-5\bungeecord-chat\1.13-SNAPSHOT\bungeecord-chat-1.13-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;C:\Users\Daniel\.m2\repository\com\mojang\authlib\1.5.21\authlib-1.5.21.jar;C:\Users\Daniel\.m2\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;C:\Users\Daniel\.m2\repository\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;C:\Users\Daniel\.m2\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\Daniel\.m2\repository\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;C:\Users\Daniel\.m2\repository\com\google\code\findbugs\jsr305\2.0.1\jsr305-2.0.1.jar;C:\Users\Daniel\.m2\repository\commons-io\commons-io\2.6\commons-io-2.6.jar;C:\Users\Daniel\IdeaProjects\worldsystem\lib\FastAsyncWorldEdit.jar;C:\Users\Daniel\.m2\repository\com\sk89q\worldedit\worldedit-core\7.0.0-SNAPSHOT\worldedit-core-7.0.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\com\sk89q\worldedit\worldedit-libs\core\7.0.0-SNAPSHOT\core-7.0.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\de\schlichtherle\truezip\6.8.3\truezip-6.8.3.jar;C:\Users\Daniel\.m2\repository\rhino\js\1.7R2\js-1.7R2.jar;C:\Users\Daniel\.m2\repository\com\googlecode\json-simple\json-simple\1.1.1\json-simple-1.1.1.jar;C:\Users\Daniel\.m2\repository\junit\junit\4.10\junit-4.10.jar;C:\Users\Daniel\.m2\repository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar;C:\Users\Daniel\.m2\repository\org\slf4j\slf4j-api\1.7.26\slf4j-api-1.7.26.jar;C:\Users\Daniel\.m2\repository\com\sk89q\worldedit\worldedit-bukkit\7.0.0-SNAPSHOT\worldedit-bukkit-7.0.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\com\sk89q\worldedit\worldedit-libs\bukkit\7.0.0-SNAPSHOT\bukkit-7.0.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\org\bukkit\bukkit\1.13.2-R0.1-SNAPSHOT\bukkit-1.13.2-R0.1-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\io\papermc\paperlib\1.0.2\paperlib-1.0.2.jar;C:\Users\Daniel\.m2\repository\org\apache\logging\log4j\log4j-slf4j-impl\2.8.1\log4j-slf4j-impl-2.8.1.jar;C:\Users\Daniel\.m2\repository\org\bstats\bstats-bukkit\1.4\bstats-bukkit-1.4.jar;C:\Users\Daniel\.m2\repository\net\myplayplanet\CommandFramework\2.0.0-SNAPSHOT\CommandFramework-2.0.0-SNAPSHOT.jar;C:\Users\Daniel\.m2\repository\net\milkbowl\vault\VaultAPI\1.6\VaultAPI-1.6.jar;C:\Users\Daniel\.m2\repository\me\clip\placeholderapi\2.10.3\placeholderapi-2.10.3.jar;C:\Users\Daniel\.m2\repository\org\projectlombok\lombok\1.18.4\lombok-1.18.4.jar;"/>
|
||||||
|
<property name="sun.cpu.endian" value="little"/>
|
||||||
|
<property name="user.home" value="C:\Users\Daniel"/>
|
||||||
|
<property name="user.language" value="de"/>
|
||||||
|
<property name="java.specification.vendor" value="Oracle Corporation"/>
|
||||||
|
<property name="java.home" value="C:\Program Files\Java\jdk1.8.0_201\jre"/>
|
||||||
|
<property name="basedir" value="C:\Users\Daniel\IdeaProjects\worldsystem"/>
|
||||||
|
<property name="file.separator" value="\"/>
|
||||||
|
<property name="line.separator" value=" "/>
|
||||||
|
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
|
||||||
|
<property name="java.specification.name" value="Java Platform API Specification"/>
|
||||||
|
<property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/>
|
||||||
|
<property name="surefire.real.class.path"
|
||||||
|
value="C:\Users\Daniel\AppData\Local\Temp\surefire3643665927397989820\surefirebooter3807952172248991728.jar"/>
|
||||||
|
<property name="sun.boot.class.path"
|
||||||
|
value="C:\Program Files\Java\jdk1.8.0_201\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_201\jre\classes"/>
|
||||||
|
<property name="user.script" value=""/>
|
||||||
|
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
|
||||||
|
<property name="java.runtime.version" value="1.8.0_201-b09"/>
|
||||||
|
<property name="user.name" value="Daniel"/>
|
||||||
|
<property name="path.separator" value=";"/>
|
||||||
|
<property name="os.version" value="10.0"/>
|
||||||
|
<property name="java.endorsed.dirs" value="C:\Program Files\Java\jdk1.8.0_201\jre\lib\endorsed"/>
|
||||||
|
<property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
|
||||||
|
<property name="file.encoding" value="Cp1252"/>
|
||||||
|
<property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
|
||||||
|
<property name="localRepository" value="C:\Users\Daniel\.m2\repository"/>
|
||||||
|
<property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/>
|
||||||
|
<property name="java.io.tmpdir" value="C:\Users\Daniel\AppData\Local\Temp\"/>
|
||||||
|
<property name="java.version" value="1.8.0_201"/>
|
||||||
|
<property name="user.dir" value="C:\Users\Daniel\IdeaProjects\worldsystem"/>
|
||||||
|
<property name="os.arch" value="amd64"/>
|
||||||
|
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
|
||||||
|
<property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/>
|
||||||
|
<property name="idea.version2019.1.3" value="true"/>
|
||||||
|
<property name="sun.os.patch.level" value=""/>
|
||||||
|
<property name="java.library.path"
|
||||||
|
value="C:\Program Files\Java\jdk1.8.0_201\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Users\Daniel\AppData\Local\Microsoft\WindowsApps;C:\Program Files\nodejs\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Windows Live\Shared;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\Daniel\AppData\Local\Programs\Python\Python36;C:\Users\Daniel\AppData\Local\Programs\Python\Python36\Scripts;C:\Program Files\flutter\bin;C:\Program Files\apache-maven-3.6.0\bin;C:\Users\Daniel\AppData\Roaming\npm;C:\Users\Daniel\AppData\Local\Android\Sdk\platform-tools;C:\Program Files\flutter\.pub-cache\bin;C:\Program Files\Git\bin;C:\Program Files\Java\jdk1.8.0_201\bin;C:\Users\Daniel\.cargo\bin;C:\Program Files\flutter\bin;C:\Program Files\ffmpeg\bin;C:\Users\Daniel\AppData\Roaming\npm;C:\Users\Daniel\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Daniel\AppData\Local\Android\Sdk\platform-tools;C:\Program Files\flutter\.pub-cache\bin;C:\Program Files\Git\bin;C:\Program Files (x86)\Nmap;."/>
|
||||||
|
<property name="java.vm.info" value="mixed mode"/>
|
||||||
|
<property name="java.vendor" value="Oracle Corporation"/>
|
||||||
|
<property name="java.vm.version" value="25.201-b09"/>
|
||||||
|
<property name="java.ext.dirs"
|
||||||
|
value="C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext"/>
|
||||||
|
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
|
||||||
|
<property name="java.class.version" value="52.0"/>
|
||||||
|
</properties>
|
||||||
|
<testcase name="asWorldCreator" classname="de.butzlabben.world.wrapper.GeneratorSettingsTest" time="0.016"/>
|
||||||
|
</testsuite>
|
Loading…
Reference in New Issue
Block a user