mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2024-12-02 13:23:21 +01:00
Update to 1.13
This commit is contained in:
parent
807f3e4b5f
commit
69313f7799
@ -4,6 +4,6 @@
|
|||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="lib" path="C:/Programmieren/FastAsyncWorldEdit.jar"/>
|
<classpathentry kind="lib" path="C:/Programmieren/FastAsyncWorldEdit.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Programmieren/worldedit-bukkit-6.1.7.2.jar"/>
|
<classpathentry kind="lib" path="C:/Programmieren/worldedit-bukkit-6.1.7.2.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Programmieren/spigot-1.12.jar" sourcepath="C:/Users/jubek/Documents/Development/JavaLibraries/Bukkit_Spigot/BuildTools/Spigot"/>
|
<classpathentry kind="lib" path="C:/Programmieren/spigot-1.13-pre7.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -2,6 +2,9 @@ name: WorldSystem
|
|||||||
version: 2.2.0.6
|
version: 2.2.0.6
|
||||||
author: Butzlabben
|
author: Butzlabben
|
||||||
main: de.butzlabben.world.WorldSystem
|
main: de.butzlabben.world.WorldSystem
|
||||||
|
|
||||||
|
api-version: 1.13
|
||||||
|
|
||||||
loadbefore: [FastAsyncWorldEdit, WorldEdit]
|
loadbefore: [FastAsyncWorldEdit, WorldEdit]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
@ -4,26 +4,21 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
options:
|
options:
|
||||||
|
|
||||||
# How the enabled item should look like
|
# How the enabled item should look like
|
||||||
enabled:
|
enabled:
|
||||||
# ItemID, for seeing them press F3 + H
|
# Material name in the Material enum
|
||||||
material: 351
|
material: LIME_DYE
|
||||||
# Data, how it should look like eg. blue, red, green
|
|
||||||
data: 10
|
|
||||||
# Displayname
|
# Displayname
|
||||||
display: '&aEnabled'
|
display: '&aEnabled'
|
||||||
|
|
||||||
# How the disabled item should look like
|
# How the disabled item should look like
|
||||||
disabled:
|
disabled:
|
||||||
material: 351
|
material: ROSE_RED
|
||||||
data: 1
|
|
||||||
display: '&cDisabled'
|
display: '&cDisabled'
|
||||||
|
|
||||||
# How the comming-soon item should look like
|
# How the comming-soon item should look like
|
||||||
coming_soon:
|
coming_soon:
|
||||||
material: 351
|
material: ORANGE_DYE
|
||||||
data: 14
|
|
||||||
display: '&6Coming soon...'
|
display: '&6Coming soon...'
|
||||||
|
|
||||||
# WorldoptionsGUI
|
# WorldoptionsGUI
|
||||||
@ -37,7 +32,7 @@ options:
|
|||||||
slot:
|
slot:
|
||||||
row: 1
|
row: 1
|
||||||
col: 8
|
col: 8
|
||||||
material: 293
|
material: DIAMOND_HOE
|
||||||
data: 0
|
data: 0
|
||||||
display: '&eReset World'
|
display: '&eReset World'
|
||||||
|
|
||||||
@ -51,8 +46,7 @@ options:
|
|||||||
state:
|
state:
|
||||||
row: 2
|
row: 2
|
||||||
col: 2
|
col: 2
|
||||||
material: 259
|
material: FLINT_AND_STEEL
|
||||||
data: 0
|
|
||||||
display: '&eToggle Fire'
|
display: '&eToggle Fire'
|
||||||
|
|
||||||
# TNT button
|
# TNT button
|
||||||
@ -64,35 +58,35 @@ options:
|
|||||||
state:
|
state:
|
||||||
row: 2
|
row: 2
|
||||||
col: 5
|
col: 5
|
||||||
material: 46
|
material: TNT
|
||||||
data: 0
|
|
||||||
display: '&eToggle TNT-Explosion'
|
display: '&eToggle TNT-Explosion'
|
||||||
|
|
||||||
players:
|
players:
|
||||||
|
|
||||||
|
skull_item:
|
||||||
|
material: PLAYER_HEAD
|
||||||
|
|
||||||
rows: 6
|
rows: 6
|
||||||
nextpage:
|
nextpage:
|
||||||
enabled: true
|
enabled: true
|
||||||
slot:
|
slot:
|
||||||
row: 6
|
row: 6
|
||||||
col: 9
|
col: 9
|
||||||
material: 175
|
material: PAPER
|
||||||
data: 0
|
|
||||||
display: '&eNext Page'
|
display: '&eNext Page'
|
||||||
pagebefore:
|
pagebefore:
|
||||||
enabled: true
|
enabled: true
|
||||||
slot:
|
slot:
|
||||||
row: 6
|
row: 6
|
||||||
col: 1
|
col: 1
|
||||||
material: 175
|
material: PAPER
|
||||||
data: 0
|
|
||||||
display: '&ePage before'
|
display: '&ePage before'
|
||||||
currentpage:
|
currentpage:
|
||||||
enabled: true
|
enabled: true
|
||||||
slot:
|
slot:
|
||||||
row: 6
|
row: 6
|
||||||
col: 5
|
col: 5
|
||||||
material: 339
|
material: DOUBLE_PLANT
|
||||||
data: 0
|
|
||||||
display: '&eCurrent page: %page'
|
display: '&eCurrent page: %page'
|
||||||
player_list_to_row: 4
|
player_list_to_row: 4
|
||||||
playerhead:
|
playerhead:
|
||||||
@ -109,8 +103,7 @@ options:
|
|||||||
state:
|
state:
|
||||||
row: 2
|
row: 2
|
||||||
col: 1
|
col: 1
|
||||||
material: 286
|
material: GOLDEN_AXE
|
||||||
data: 0
|
|
||||||
display: '&eToggle Build-Permission'
|
display: '&eToggle Build-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -123,8 +116,7 @@ options:
|
|||||||
state:
|
state:
|
||||||
row: 2
|
row: 2
|
||||||
col: 2
|
col: 2
|
||||||
material: 426
|
material: END_CRYSTAL
|
||||||
data: 0
|
|
||||||
display: '&eToggle GameMode-Permission'
|
display: '&eToggle GameMode-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -137,8 +129,7 @@ options:
|
|||||||
state:
|
state:
|
||||||
row: 2
|
row: 2
|
||||||
col: 3
|
col: 3
|
||||||
material: 345
|
material: COMPASS
|
||||||
data: 0
|
|
||||||
display: '&eToggle Teleport-Permission'
|
display: '&eToggle Teleport-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -152,25 +143,10 @@ options:
|
|||||||
row: 2
|
row: 2
|
||||||
col: 4
|
col: 4
|
||||||
material: 347
|
material: 347
|
||||||
data: 0
|
|
||||||
display: '&eToggle Time-Permission'
|
display: '&eToggle Time-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
- '&7To change the time on this world'
|
- '&7To change the time on this world'
|
||||||
worldborder:
|
|
||||||
enabled: false
|
|
||||||
slot:
|
|
||||||
row: 1
|
|
||||||
col: 5
|
|
||||||
state:
|
|
||||||
row: 2
|
|
||||||
col: 5
|
|
||||||
material: 345
|
|
||||||
data: 0
|
|
||||||
display: '&eToggle Worldborder-Permission'
|
|
||||||
lore:
|
|
||||||
- '&7Toggles the permission for a player'
|
|
||||||
- '&7To change the worldborder on this world'
|
|
||||||
addmember:
|
addmember:
|
||||||
enabled: false
|
enabled: false
|
||||||
slot:
|
slot:
|
||||||
@ -180,7 +156,6 @@ options:
|
|||||||
row: 2
|
row: 2
|
||||||
col: 6
|
col: 6
|
||||||
material: 399
|
material: 399
|
||||||
data: 0
|
|
||||||
display: '&eToggle Addmember-Permission'
|
display: '&eToggle Addmember-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -194,25 +169,10 @@ options:
|
|||||||
row: 2
|
row: 2
|
||||||
col: 6
|
col: 6
|
||||||
material: 286
|
material: 286
|
||||||
data: 0
|
|
||||||
display: '&eToggle Delmember-Permission'
|
display: '&eToggle Delmember-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
- '&7To remove a member from this world'
|
- '&7To remove a member from this world'
|
||||||
addmember:
|
|
||||||
enabled: false
|
|
||||||
slot:
|
|
||||||
row: 1
|
|
||||||
col: 7
|
|
||||||
state:
|
|
||||||
row: 2
|
|
||||||
col: 7
|
|
||||||
material: 399
|
|
||||||
data: 0
|
|
||||||
display: '&eToggle Addmember-Permission'
|
|
||||||
lore:
|
|
||||||
- '&7Toggles the permission for a player'
|
|
||||||
- '&7To add a member to this world'
|
|
||||||
setpermissions:
|
setpermissions:
|
||||||
enabled: false
|
enabled: false
|
||||||
slot:
|
slot:
|
||||||
@ -222,7 +182,6 @@ options:
|
|||||||
row: 2
|
row: 2
|
||||||
col: 8
|
col: 8
|
||||||
material: 331
|
material: 331
|
||||||
data: 0
|
|
||||||
display: '&eToggle Setpermissions-Permission'
|
display: '&eToggle Setpermissions-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -236,7 +195,6 @@ options:
|
|||||||
row: 2
|
row: 2
|
||||||
col: 9
|
col: 9
|
||||||
material: 421
|
material: 421
|
||||||
data: 0
|
|
||||||
display: '&eToggle Addmember-Permission'
|
display: '&eToggle Addmember-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -250,14 +208,12 @@ worldsystem:
|
|||||||
slot:
|
slot:
|
||||||
row: 1
|
row: 1
|
||||||
col: 4
|
col: 4
|
||||||
material: 298
|
material: LEATHER_HELMET
|
||||||
data: 0
|
|
||||||
display: '&ePlayer Options'
|
display: '&ePlayer Options'
|
||||||
worldoptions:
|
worldoptions:
|
||||||
enabled: true
|
enabled: true
|
||||||
slot:
|
slot:
|
||||||
row: 1
|
row: 1
|
||||||
col: 6
|
col: 6
|
||||||
material: 2
|
material: GRASS_BLOCK
|
||||||
data: 0
|
|
||||||
display: '&eWorld Options'
|
display: '&eWorld Options'
|
@ -1,5 +1,6 @@
|
|||||||
package de.butzlabben.inventory;
|
package de.butzlabben.inventory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -32,28 +33,36 @@ public class OrcItem {
|
|||||||
setItemStack(mat, display, lore);
|
setItemStack(mat, display, lore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem(int id, byte data, String display, List<String> lore) {
|
// public OrcItem(int id, byte data, String display, List<String> lore) {
|
||||||
setItemStack(id, data, display, lore);
|
// setItemStack(id, data, display, lore);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
// @SuppressWarnings("deprecation")
|
||||||
public OrcItem setItemStack(int id, byte data, String display, List<String> lore) {
|
// public OrcItem setItemStack(int id, byte data, String display, List<String> lore) {
|
||||||
is = new ItemStack(id, 1, data);
|
// is = new ItemStack(id, 1, data);
|
||||||
|
// ItemMeta meta = is.getItemMeta();
|
||||||
|
// if (meta != null) {
|
||||||
|
// meta.setDisplayName(display);
|
||||||
|
// meta.setLore(lore);
|
||||||
|
// is.setItemMeta(meta);
|
||||||
|
// }
|
||||||
|
// return this;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public OrcItem(int id, byte data, String display, String... lore) {
|
||||||
|
// setItemStack(id, data, display, lore);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public OrcItem setItemStack(int id, byte data, String display, String[] lore) {
|
||||||
|
// return setItemStack(id, data, display, Arrays.asList(lore));
|
||||||
|
// }
|
||||||
|
|
||||||
|
public OrcItem(Material material, byte data, String display, ArrayList<String> lore) {
|
||||||
|
is = new ItemStack(material, 1, data);
|
||||||
ItemMeta meta = is.getItemMeta();
|
ItemMeta meta = is.getItemMeta();
|
||||||
if (meta != null) {
|
meta.setDisplayName(display);
|
||||||
meta.setDisplayName(display);
|
meta.setLore(lore);
|
||||||
meta.setLore(lore);
|
is.setItemMeta(meta);
|
||||||
is.setItemMeta(meta);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrcItem(int id, byte data, String display, String... lore) {
|
|
||||||
setItemStack(id, data, display, lore);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrcItem setItemStack(int id, byte data, String display, String[] lore) {
|
|
||||||
return setItemStack(id, data, display, Arrays.asList(lore));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrcItem setItemStack(Material mat, String display, List<String> lore) {
|
public OrcItem setItemStack(Material mat, String display, List<String> lore) {
|
||||||
|
@ -63,8 +63,14 @@ public class WorldSystem extends JavaPlugin {
|
|||||||
|
|
||||||
public static CreatorAdapter creator;
|
public static CreatorAdapter creator;
|
||||||
|
|
||||||
|
private static boolean is1_13 = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
//Set right version
|
||||||
|
if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1_13") )
|
||||||
|
is1_13 = true;
|
||||||
|
|
||||||
createConfigs();
|
createConfigs();
|
||||||
|
|
||||||
PluginManager pm = Bukkit.getPluginManager();
|
PluginManager pm = Bukkit.getPluginManager();
|
||||||
@ -216,4 +222,7 @@ public class WorldSystem extends JavaPlugin {
|
|||||||
return JavaPlugin.getPlugin(WorldSystem.class);
|
return JavaPlugin.getPlugin(WorldSystem.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isIs1_13() {
|
||||||
|
return is1_13;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import java.nio.file.Files;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -31,7 +32,13 @@ public class GuiConfig {
|
|||||||
file = f;
|
file = f;
|
||||||
if (file.exists() == false) {
|
if (file.exists() == false) {
|
||||||
try {
|
try {
|
||||||
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("gui.yml");
|
String guiFileResource;
|
||||||
|
if (WorldSystem.isIs1_13()) {
|
||||||
|
guiFileResource = "1_13_gui.yml";
|
||||||
|
} else {
|
||||||
|
guiFileResource = "old_gui.yml";
|
||||||
|
}
|
||||||
|
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");
|
||||||
@ -45,7 +52,8 @@ public class GuiConfig {
|
|||||||
|
|
||||||
public static YamlConfiguration getConfig() {
|
public static YamlConfiguration getConfig() {
|
||||||
try {
|
try {
|
||||||
return YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
return YamlConfiguration
|
||||||
|
.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -83,18 +91,15 @@ public class GuiConfig {
|
|||||||
return colored;
|
return colored;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getId(FileConfiguration cfg, String path) {
|
|
||||||
return cfg.getInt(path + ".material");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte getData(FileConfiguration cfg, String path) {
|
public static byte getData(FileConfiguration cfg, String path) {
|
||||||
return (byte) cfg.getInt(path + ".data");
|
return (byte) cfg.getInt(path + ".data", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Material getMaterial(FileConfiguration cfg, String path) {
|
public static Material getMaterial(FileConfiguration cfg, String path) {
|
||||||
try {
|
try {
|
||||||
return Material.valueOf(cfg.getString(path + ".material").toUpperCase());
|
return Material.valueOf(cfg.getString(path + ".material").toUpperCase());
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cUnknown material: " + path);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +107,7 @@ public class GuiConfig {
|
|||||||
public static OrcItem getItem(String path) {
|
public static OrcItem getItem(String path) {
|
||||||
YamlConfiguration cfg = getConfig();
|
YamlConfiguration cfg = getConfig();
|
||||||
try {
|
try {
|
||||||
return new OrcItem(getId(cfg, path), getData(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
|
return new OrcItem(getMaterial(cfg, path), getData(cfg, path), getDisplay(cfg, path), getLore(cfg, path));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -124,4 +129,7 @@ public class GuiConfig {
|
|||||||
return getItem("options.coming_soon");
|
return getItem("options.coming_soon");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Material getSkullItem() {
|
||||||
|
return getMaterial(getConfig(), "options.players.skull_item");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,15 +50,10 @@ public class SettingsConfig {
|
|||||||
|
|
||||||
w.getWorldBorder().setSize(size);
|
w.getWorldBorder().setSize(size);
|
||||||
|
|
||||||
System.out.println(cfg.getBoolean("worldborder.center.as_spawn", true));
|
|
||||||
if (cfg.getBoolean("worldborder.center.as_spawn", true)) {
|
if (cfg.getBoolean("worldborder.center.as_spawn", true)) {
|
||||||
System.out.println(w.getSpawnLocation());
|
|
||||||
System.out.println(w.getWorldBorder().getCenter());
|
|
||||||
if (PluginConfig.useWorldSpawn()) {
|
if (PluginConfig.useWorldSpawn()) {
|
||||||
System.out.println("s");
|
|
||||||
w.getWorldBorder().setCenter(PluginConfig.getWorldSpawn(w));
|
w.getWorldBorder().setCenter(PluginConfig.getWorldSpawn(w));
|
||||||
} else {
|
} else {
|
||||||
System.out.println("a");
|
|
||||||
w.getWorldBorder().setCenter(w.getSpawnLocation());
|
w.getWorldBorder().setCenter(w.getSpawnLocation());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -26,6 +26,7 @@ public class PlayersPageGUI extends OrcInventory {
|
|||||||
private final static String path = "options.players.";
|
private final static String path = "options.players.";
|
||||||
private static HashMap<UUID, Pair<Integer, Integer>> pages = new HashMap<>();
|
private static HashMap<UUID, Pair<Integer, Integer>> pages = new HashMap<>();
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public PlayersPageGUI(int page, UUID ex, HashMap<UUID, String> players, int next, int before) {
|
public PlayersPageGUI(int page, UUID ex, HashMap<UUID, String> players, int next, int before) {
|
||||||
super("Players added to this world", GuiConfig.getRows("options.players"), false);
|
super("Players added to this world", GuiConfig.getRows("options.players"), false);
|
||||||
pages.put(ex, Pair.of(next, before));
|
pages.put(ex, Pair.of(next, before));
|
||||||
@ -65,7 +66,7 @@ public class PlayersPageGUI extends OrcInventory {
|
|||||||
YamlConfiguration cfg = GuiConfig.getConfig();
|
YamlConfiguration cfg = GuiConfig.getConfig();
|
||||||
OrcItem oi = null;
|
OrcItem oi = null;
|
||||||
try {
|
try {
|
||||||
oi = new OrcItem(GuiConfig.getId(cfg, path), GuiConfig.getData(cfg, path),
|
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));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
@ -76,11 +77,12 @@ public class PlayersPageGUI extends OrcInventory {
|
|||||||
}
|
}
|
||||||
addItem(GuiConfig.getSlot(path), oi);
|
addItem(GuiConfig.getSlot(path), oi);
|
||||||
|
|
||||||
// Spieler reinladen
|
// Load players
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (UUID uuid : players.keySet()) {
|
for (UUID uuid : players.keySet()) {
|
||||||
String name = players.get(uuid);
|
String name = players.get(uuid);
|
||||||
ItemStack is = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
|
Material skullItem = GuiConfig.getSkullItem();
|
||||||
|
ItemStack is = new ItemStack(skullItem, 1, (short) 3);
|
||||||
SkullMeta sm = (SkullMeta) is.getItemMeta();
|
SkullMeta sm = (SkullMeta) is.getItemMeta();
|
||||||
sm.setOwner(name);
|
sm.setOwner(name);
|
||||||
sm.setDisplayName(
|
sm.setDisplayName(
|
||||||
|
@ -90,6 +90,12 @@ public class SystemWorld {
|
|||||||
* w == null
|
* w == null
|
||||||
*/
|
*/
|
||||||
public void directUnload(World w) {
|
public void directUnload(World w) {
|
||||||
|
if (!Bukkit.isPrimaryThread()) {
|
||||||
|
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
|
||||||
|
directUnload(w);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
Preconditions.checkNotNull(w, "world must not be null");
|
Preconditions.checkNotNull(w, "world must not be null");
|
||||||
unloading = true;
|
unloading = true;
|
||||||
w.save();
|
w.save();
|
||||||
@ -126,6 +132,12 @@ public class SystemWorld {
|
|||||||
* w == null
|
* w == null
|
||||||
*/
|
*/
|
||||||
public void unloadLater(World w) {
|
public void unloadLater(World w) {
|
||||||
|
if (!Bukkit.isPrimaryThread()) {
|
||||||
|
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
|
||||||
|
unloadLater(w);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
Preconditions.checkNotNull(w, "world must not be null");
|
Preconditions.checkNotNull(w, "world must not be null");
|
||||||
WorldUnloadEvent event = new WorldUnloadEvent(this);
|
WorldUnloadEvent event = new WorldUnloadEvent(this);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
@ -177,6 +189,12 @@ public class SystemWorld {
|
|||||||
* if player is not online
|
* if player is not online
|
||||||
*/
|
*/
|
||||||
public void load(Player p) {
|
public void load(Player p) {
|
||||||
|
if (!Bukkit.isPrimaryThread()) {
|
||||||
|
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
|
||||||
|
load(p);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
Preconditions.checkNotNull(p, "player must not be null");
|
Preconditions.checkNotNull(p, "player must not be null");
|
||||||
Preconditions.checkArgument(p.isOnline(), "player must be online");
|
Preconditions.checkArgument(p.isOnline(), "player must be online");
|
||||||
|
|
||||||
|
@ -10,12 +10,14 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
|
import de.butzlabben.world.config.PluginConfig;
|
||||||
import de.butzlabben.world.config.WorldConfig;
|
import de.butzlabben.world.config.WorldConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a player, on a systemworld or not
|
* This class represents a player, on a systemworld or not but be carefull when
|
||||||
* but be carefull when accesing some methods
|
* accesing some methods when the player is not on a systemworld like
|
||||||
* when the player is not on a systemworld like toggleBuild()
|
* toggleBuild()
|
||||||
|
*
|
||||||
* @author Butzlabben
|
* @author Butzlabben
|
||||||
* @since 15.03.2018
|
* @since 15.03.2018
|
||||||
*/
|
*/
|
||||||
@ -33,6 +35,7 @@ public class WorldPlayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* toggles building for this player
|
* toggles building for this player
|
||||||
|
*
|
||||||
* @return whether can build or not
|
* @return whether can build or not
|
||||||
*/
|
*/
|
||||||
public boolean toggleBuild() {
|
public boolean toggleBuild() {
|
||||||
@ -64,6 +67,7 @@ public class WorldPlayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* toggles teleporting for this player
|
* toggles teleporting for this player
|
||||||
|
*
|
||||||
* @return whether can teleport or not
|
* @return whether can teleport or not
|
||||||
*/
|
*/
|
||||||
public boolean toggleTeleport() {
|
public boolean toggleTeleport() {
|
||||||
@ -95,12 +99,12 @@ public class WorldPlayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* toggles gamemode changing for this player
|
* toggles gamemode changing for this player
|
||||||
|
*
|
||||||
* @return whether can change his gamemode or not
|
* @return whether can change his gamemode or not
|
||||||
*/
|
*/
|
||||||
public boolean toggleGamemode() {
|
public boolean toggleGamemode() {
|
||||||
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
|
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
|
||||||
|
|
||||||
|
|
||||||
WorldConfig wc = WorldConfig.getWorldConfig(worldname);
|
WorldConfig wc = WorldConfig.getWorldConfig(worldname);
|
||||||
if (!wc.isMember(p.getUniqueId()))
|
if (!wc.isMember(p.getUniqueId()))
|
||||||
return false;
|
return false;
|
||||||
@ -149,9 +153,12 @@ public class WorldPlayer {
|
|||||||
*/
|
*/
|
||||||
public boolean isOnSystemWorld() {
|
public boolean isOnSystemWorld() {
|
||||||
File worldconfig = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
|
File worldconfig = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
|
||||||
|
if (!worldconfig.exists()) {
|
||||||
|
worldconfig = new File(PluginConfig.getWorlddir() + worldname + "/worldconfig.yml");
|
||||||
|
}
|
||||||
if (worldconfig.exists()) {
|
if (worldconfig.exists()) {
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(worldconfig);
|
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(worldconfig);
|
||||||
if(cfg.getString("Informations.Owner.PlayerUUID") == null) {
|
if (cfg.getString("Informations.Owner.PlayerUUID") == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -166,19 +173,19 @@ public class WorldPlayer {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if he ist the owner
|
* @return if he ist the owner
|
||||||
*/
|
*/
|
||||||
public boolean isOwnerofWorld() {
|
public boolean isOwnerofWorld() {
|
||||||
if(!isOnSystemWorld())
|
if (!isOnSystemWorld())
|
||||||
return false;
|
return false;
|
||||||
WorldConfig wc = WorldConfig.getWorldConfig(worldname);
|
WorldConfig wc = WorldConfig.getWorldConfig(worldname);
|
||||||
return wc.getOwner().equals(p.getUniqueId());
|
return wc.getOwner().equals(p.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldname of the world to be tested
|
* @param worldname
|
||||||
|
* of the world to be tested
|
||||||
* @return worldname if he is the owner of the specified world
|
* @return worldname if he is the owner of the specified world
|
||||||
*/
|
*/
|
||||||
public boolean isMemberofWorld(String worldname) {
|
public boolean isMemberofWorld(String worldname) {
|
||||||
|
@ -22,7 +22,6 @@ public class FlatGenerator extends AbstractGenerator {
|
|||||||
setGrass(height);
|
setGrass(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) {
|
public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) {
|
||||||
setBiome(biomes, Biome.PLAINS);
|
setBiome(biomes, Biome.PLAINS);
|
||||||
return result;
|
return result;
|
||||||
|
@ -36,7 +36,6 @@ public class GridGenerator extends AbstractGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) {
|
public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) {
|
||||||
setBiome(biomes, Biome.PLAINS);
|
setBiome(biomes, Biome.PLAINS);
|
||||||
if(grid == 16) {
|
if(grid == 16) {
|
||||||
|
@ -3,15 +3,13 @@ package de.jubeki.generator;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
|
|
||||||
public class VoidGenerator extends AbstractGenerator {
|
public class VoidGenerator extends AbstractGenerator {
|
||||||
|
|
||||||
private final byte[][] result = new byte[16][];
|
private final byte[][] result = new byte[16][];
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) {
|
public byte[][] generateBlockSections(World world, Random random, int x, int z, BiomeGrid biomes) {
|
||||||
setBiome(biomes, Biome.VOID);
|
// setBiome(biomes, Biome.VOID);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,25 +4,24 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
options:
|
options:
|
||||||
|
|
||||||
# How the enabled item should look like
|
# How the enabled item should look like
|
||||||
enabled:
|
enabled:
|
||||||
# ItemID, for seeing them press F3 + H
|
# Material name in the Material enum
|
||||||
material: 351
|
material: INK_SACK
|
||||||
# Data, how it should look like eg. blue, red, green
|
# Data, how it should look like eg. blue, red, green
|
||||||
data: 10
|
data: 10
|
||||||
# Displayname
|
# Displayname
|
||||||
display: '&aEnabled'
|
display: '&aEnabled'
|
||||||
|
|
||||||
# How the disabled item should look like
|
# How the disabled item should look like
|
||||||
disabled:
|
disabled:
|
||||||
material: 351
|
material: INK_SACK
|
||||||
data: 1
|
data: 1
|
||||||
display: '&cDisabled'
|
display: '&cDisabled'
|
||||||
|
|
||||||
# How the comming-soon item should look like
|
# How the comming-soon item should look like
|
||||||
coming_soon:
|
coming_soon:
|
||||||
material: 351
|
material: INK_SACK
|
||||||
data: 14
|
data: 14
|
||||||
display: '&6Coming soon...'
|
display: '&6Coming soon...'
|
||||||
|
|
||||||
@ -37,7 +36,7 @@ options:
|
|||||||
slot:
|
slot:
|
||||||
row: 1
|
row: 1
|
||||||
col: 8
|
col: 8
|
||||||
material: 293
|
material: DIAMOND_HOE
|
||||||
data: 0
|
data: 0
|
||||||
display: '&eReset World'
|
display: '&eReset World'
|
||||||
|
|
||||||
@ -51,8 +50,7 @@ options:
|
|||||||
state:
|
state:
|
||||||
row: 2
|
row: 2
|
||||||
col: 2
|
col: 2
|
||||||
material: 259
|
material: FLINT_AND_STEEL
|
||||||
data: 0
|
|
||||||
display: '&eToggle Fire'
|
display: '&eToggle Fire'
|
||||||
|
|
||||||
# TNT button
|
# TNT button
|
||||||
@ -64,35 +62,34 @@ options:
|
|||||||
state:
|
state:
|
||||||
row: 2
|
row: 2
|
||||||
col: 5
|
col: 5
|
||||||
material: 46
|
material: TNT
|
||||||
data: 0
|
|
||||||
display: '&eToggle TNT-Explosion'
|
display: '&eToggle TNT-Explosion'
|
||||||
|
|
||||||
players:
|
players:
|
||||||
|
skull_item:
|
||||||
|
material: SKULL_ITEM
|
||||||
|
|
||||||
rows: 6
|
rows: 6
|
||||||
nextpage:
|
nextpage:
|
||||||
enabled: true
|
enabled: true
|
||||||
slot:
|
slot:
|
||||||
row: 6
|
row: 6
|
||||||
col: 9
|
col: 9
|
||||||
material: 175
|
material: PAPER
|
||||||
data: 0
|
|
||||||
display: '&eNext Page'
|
display: '&eNext Page'
|
||||||
pagebefore:
|
pagebefore:
|
||||||
enabled: true
|
enabled: true
|
||||||
slot:
|
slot:
|
||||||
row: 6
|
row: 6
|
||||||
col: 1
|
col: 1
|
||||||
material: 175
|
material: PAPER
|
||||||
data: 0
|
|
||||||
display: '&ePage before'
|
display: '&ePage before'
|
||||||
currentpage:
|
currentpage:
|
||||||
enabled: true
|
enabled: true
|
||||||
slot:
|
slot:
|
||||||
row: 6
|
row: 6
|
||||||
col: 5
|
col: 5
|
||||||
material: 339
|
material: DOUBLE_PLANT
|
||||||
data: 0
|
|
||||||
display: '&eCurrent page: %page'
|
display: '&eCurrent page: %page'
|
||||||
player_list_to_row: 4
|
player_list_to_row: 4
|
||||||
playerhead:
|
playerhead:
|
||||||
@ -109,8 +106,7 @@ options:
|
|||||||
state:
|
state:
|
||||||
row: 2
|
row: 2
|
||||||
col: 1
|
col: 1
|
||||||
material: 286
|
material: GOLD_AXE
|
||||||
data: 0
|
|
||||||
display: '&eToggle Build-Permission'
|
display: '&eToggle Build-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -123,8 +119,7 @@ options:
|
|||||||
state:
|
state:
|
||||||
row: 2
|
row: 2
|
||||||
col: 2
|
col: 2
|
||||||
material: 426
|
material: END_CRYSTAL
|
||||||
data: 0
|
|
||||||
display: '&eToggle GameMode-Permission'
|
display: '&eToggle GameMode-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -137,8 +132,7 @@ options:
|
|||||||
state:
|
state:
|
||||||
row: 2
|
row: 2
|
||||||
col: 3
|
col: 3
|
||||||
material: 345
|
material: COMPASS
|
||||||
data: 0
|
|
||||||
display: '&eToggle Teleport-Permission'
|
display: '&eToggle Teleport-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -152,25 +146,10 @@ options:
|
|||||||
row: 2
|
row: 2
|
||||||
col: 4
|
col: 4
|
||||||
material: 347
|
material: 347
|
||||||
data: 0
|
|
||||||
display: '&eToggle Time-Permission'
|
display: '&eToggle Time-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
- '&7To change the time on this world'
|
- '&7To change the time on this world'
|
||||||
worldborder:
|
|
||||||
enabled: false
|
|
||||||
slot:
|
|
||||||
row: 1
|
|
||||||
col: 5
|
|
||||||
state:
|
|
||||||
row: 2
|
|
||||||
col: 5
|
|
||||||
material: 345
|
|
||||||
data: 0
|
|
||||||
display: '&eToggle Worldborder-Permission'
|
|
||||||
lore:
|
|
||||||
- '&7Toggles the permission for a player'
|
|
||||||
- '&7To change the worldborder on this world'
|
|
||||||
addmember:
|
addmember:
|
||||||
enabled: false
|
enabled: false
|
||||||
slot:
|
slot:
|
||||||
@ -180,7 +159,6 @@ options:
|
|||||||
row: 2
|
row: 2
|
||||||
col: 6
|
col: 6
|
||||||
material: 399
|
material: 399
|
||||||
data: 0
|
|
||||||
display: '&eToggle Addmember-Permission'
|
display: '&eToggle Addmember-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -194,25 +172,10 @@ options:
|
|||||||
row: 2
|
row: 2
|
||||||
col: 6
|
col: 6
|
||||||
material: 286
|
material: 286
|
||||||
data: 0
|
|
||||||
display: '&eToggle Delmember-Permission'
|
display: '&eToggle Delmember-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
- '&7To remove a member from this world'
|
- '&7To remove a member from this world'
|
||||||
addmember:
|
|
||||||
enabled: false
|
|
||||||
slot:
|
|
||||||
row: 1
|
|
||||||
col: 7
|
|
||||||
state:
|
|
||||||
row: 2
|
|
||||||
col: 7
|
|
||||||
material: 399
|
|
||||||
data: 0
|
|
||||||
display: '&eToggle Addmember-Permission'
|
|
||||||
lore:
|
|
||||||
- '&7Toggles the permission for a player'
|
|
||||||
- '&7To add a member to this world'
|
|
||||||
setpermissions:
|
setpermissions:
|
||||||
enabled: false
|
enabled: false
|
||||||
slot:
|
slot:
|
||||||
@ -222,7 +185,6 @@ options:
|
|||||||
row: 2
|
row: 2
|
||||||
col: 8
|
col: 8
|
||||||
material: 331
|
material: 331
|
||||||
data: 0
|
|
||||||
display: '&eToggle Setpermissions-Permission'
|
display: '&eToggle Setpermissions-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -236,7 +198,6 @@ options:
|
|||||||
row: 2
|
row: 2
|
||||||
col: 9
|
col: 9
|
||||||
material: 421
|
material: 421
|
||||||
data: 0
|
|
||||||
display: '&eToggle Addmember-Permission'
|
display: '&eToggle Addmember-Permission'
|
||||||
lore:
|
lore:
|
||||||
- '&7Toggles the permission for a player'
|
- '&7Toggles the permission for a player'
|
||||||
@ -250,14 +211,12 @@ worldsystem:
|
|||||||
slot:
|
slot:
|
||||||
row: 1
|
row: 1
|
||||||
col: 4
|
col: 4
|
||||||
material: 298
|
material: LEATHER_HELMET
|
||||||
data: 0
|
|
||||||
display: '&ePlayer Options'
|
display: '&ePlayer Options'
|
||||||
worldoptions:
|
worldoptions:
|
||||||
enabled: true
|
enabled: true
|
||||||
slot:
|
slot:
|
||||||
row: 1
|
row: 1
|
||||||
col: 6
|
col: 6
|
||||||
material: 2
|
material: GRASS
|
||||||
data: 0
|
|
||||||
display: '&eWorld Options'
|
display: '&eWorld Options'
|
@ -2,6 +2,9 @@ name: WorldSystem
|
|||||||
version: 2.2.0.6
|
version: 2.2.0.6
|
||||||
author: Butzlabben
|
author: Butzlabben
|
||||||
main: de.butzlabben.world.WorldSystem
|
main: de.butzlabben.world.WorldSystem
|
||||||
|
|
||||||
|
api-version: 1.13
|
||||||
|
|
||||||
loadbefore: [FastAsyncWorldEdit, WorldEdit]
|
loadbefore: [FastAsyncWorldEdit, WorldEdit]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user