mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2024-12-02 13:23:21 +01:00
See 2.1.2.1 and 2.1.2.2
This commit is contained in:
parent
7b7646dcc7
commit
5610b9cf9e
@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="lib" path="C:/Programmieren/spigot-1.12.jar" sourcepath="C:/Program Files/Java/jdk1.8.0_131/src.zip"/>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="lib" path="C:/Programmieren/dynmap-2.5.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/FastAsyncWorldEdit.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Programmieren/worldedit-bukkit-6.1.7.2.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
name: WorldSystem
|
name: WorldSystem
|
||||||
version: 2.1.2
|
version: 2.1.2.2
|
||||||
author: Butzlabben
|
author: Butzlabben
|
||||||
main: de.butzlabben.world.WorldSystem
|
main: de.butzlabben.world.WorldSystem
|
||||||
|
loadbefore: [FastAsyncWorldEdit, WorldEdit]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
ws:
|
ws:
|
||||||
|
@ -44,6 +44,8 @@ import de.butzlabben.world.listener.BlockListener;
|
|||||||
import de.butzlabben.world.listener.CommandListener;
|
import de.butzlabben.world.listener.CommandListener;
|
||||||
import de.butzlabben.world.listener.PlayerDeathListener;
|
import de.butzlabben.world.listener.PlayerDeathListener;
|
||||||
import de.butzlabben.world.listener.PlayerLeaveListener;
|
import de.butzlabben.world.listener.PlayerLeaveListener;
|
||||||
|
import de.butzlabben.world.wrapper.AsyncCreatorAdapter;
|
||||||
|
import de.butzlabben.world.wrapper.CreatorAdapter;
|
||||||
import de.butzlabben.world.wrapper.SystemWorld;
|
import de.butzlabben.world.wrapper.SystemWorld;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,6 +62,8 @@ public class WorldSystem extends JavaPlugin {
|
|||||||
final private String version = this.getDescription().getVersion();
|
final private String version = this.getDescription().getVersion();
|
||||||
public static OrcInventory mainGUI;
|
public static OrcInventory mainGUI;
|
||||||
|
|
||||||
|
public static CreatorAdapter creator;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
createConfigs();
|
createConfigs();
|
||||||
@ -126,7 +130,7 @@ public class WorldSystem extends JavaPlugin {
|
|||||||
getCommand("ws togglegm").setExecutor(new WSToggleGMCommand());
|
getCommand("ws togglegm").setExecutor(new WSToggleGMCommand());
|
||||||
getCommand("ws togglebuild").setExecutor(new WSToggleBuildCommand());
|
getCommand("ws togglebuild").setExecutor(new WSToggleBuildCommand());
|
||||||
getCommand("ws delete").setExecutor(new WSDeleteCommand());
|
getCommand("ws delete").setExecutor(new WSDeleteCommand());
|
||||||
|
|
||||||
getCommand("ws confirm").setExecutor(new WSConfirmCommand());
|
getCommand("ws confirm").setExecutor(new WSConfirmCommand());
|
||||||
|
|
||||||
getCommand("ws gui").setExecutor(new GuiCommand());
|
getCommand("ws gui").setExecutor(new GuiCommand());
|
||||||
@ -136,9 +140,20 @@ public class WorldSystem extends JavaPlugin {
|
|||||||
System.setProperty("bstats.relocatecheck", "false");
|
System.setProperty("bstats.relocatecheck", "false");
|
||||||
Metrics m = new Metrics(this);
|
Metrics m = new Metrics(this);
|
||||||
m.addCustomChart(new Metrics.SingleLineChart("worlds", Entry::entrys));
|
m.addCustomChart(new Metrics.SingleLineChart("worlds", Entry::entrys));
|
||||||
|
|
||||||
AutoUpdater.startAsync();
|
AutoUpdater.startAsync();
|
||||||
|
|
||||||
|
//Choose right creatoradapter for #16
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null
|
||||||
|
&& Bukkit.getPluginManager().getPlugin("WorldEdit") != null) {
|
||||||
|
creator = new AsyncCreatorAdapter();
|
||||||
|
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found FAWE! Try now to create worlds async");
|
||||||
|
} else {
|
||||||
|
creator = (c) -> {
|
||||||
|
Bukkit.getWorlds().add(c.createWorld());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Succesfully enabled WorldSystem v" + version);
|
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Succesfully enabled WorldSystem v" + version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class WSToggleBuildCommand implements CommandExecutor {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
OfflinePlayer a = Bukkit.getOfflinePlayer(args[1]);
|
OfflinePlayer a = Bukkit.getOfflinePlayer(args[1]);
|
||||||
WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
|
WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
|
||||||
if (wc.isMember(a.getUniqueId())) {
|
if (!wc.isMember(a.getUniqueId())) {
|
||||||
p.sendMessage(MessageConfig.getNoMemberOwn());
|
p.sendMessage(MessageConfig.getNoMemberOwn());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class WSToggleGMCommand implements CommandExecutor {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
OfflinePlayer a = Bukkit.getOfflinePlayer(args[1]);
|
OfflinePlayer a = Bukkit.getOfflinePlayer(args[1]);
|
||||||
WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
|
WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
|
||||||
if (wc.isMember(a.getUniqueId())) {
|
if (!wc.isMember(a.getUniqueId())) {
|
||||||
p.sendMessage(MessageConfig.getNoMemberOwn());
|
p.sendMessage(MessageConfig.getNoMemberOwn());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class WSToggleTPCommand implements CommandExecutor {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
OfflinePlayer a = Bukkit.getOfflinePlayer(args[1]);
|
OfflinePlayer a = Bukkit.getOfflinePlayer(args[1]);
|
||||||
WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
|
WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
|
||||||
if (wc.isMember(a.getUniqueId())) {
|
if (!wc.isMember(a.getUniqueId())) {
|
||||||
p.sendMessage(MessageConfig.getNoMemberOwn());
|
p.sendMessage(MessageConfig.getNoMemberOwn());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ import de.butzlabben.world.GameProfileBuilder;
|
|||||||
*/
|
*/
|
||||||
public class WorldConfig {
|
public class WorldConfig {
|
||||||
|
|
||||||
private 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()) {
|
||||||
worldconfig = new File(PluginConfig.getWorlddir() + "/" + worldname + "/worldconfig.yml");
|
worldconfig = new File(PluginConfig.getWorlddir() + "/" + worldname + "/worldconfig.yml");
|
||||||
|
@ -2,9 +2,6 @@ package de.butzlabben.world.listener;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
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;
|
||||||
@ -14,20 +11,18 @@ import org.bukkit.event.block.BlockIgniteEvent;
|
|||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
|
||||||
|
import de.butzlabben.world.config.WorldConfig;
|
||||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||||
|
|
||||||
public class BlockListener implements Listener {
|
public class BlockListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onExplode(EntityExplodeEvent e) {
|
public void onExplode(EntityExplodeEvent e) {
|
||||||
World w = e.getLocation().getWorld();
|
File file = WorldConfig.getWorldFile(e.getLocation().getWorld().getName());
|
||||||
File file = new File(Bukkit.getWorldContainer(), w.getName() + "/worldconfig.yml");
|
if(!file.exists())
|
||||||
if (file.exists()) {
|
return;
|
||||||
e.setCancelled(true);
|
WorldConfig wc = WorldConfig.getWorldConfig(e.getLocation().getWorld().getName());
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
e.setCancelled(!wc.isTnt());
|
||||||
boolean b = cfg.getBoolean("Settings.TNTDamage");
|
|
||||||
e.setCancelled(!b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -39,12 +34,10 @@ public class BlockListener implements Listener {
|
|||||||
WorldPlayer wp = new WorldPlayer(p, worldname);
|
WorldPlayer wp = new WorldPlayer(p, worldname);
|
||||||
if (!wp.isOnSystemWorld())
|
if (!wp.isOnSystemWorld())
|
||||||
return;
|
return;
|
||||||
|
if(!wp.isMember())
|
||||||
|
return;
|
||||||
if (!wp.isOwnerofWorld()) {
|
if (!wp.isOwnerofWorld()) {
|
||||||
File file = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
|
e.setCancelled(!wp.canBuild());
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
|
||||||
String uuid = p.getUniqueId().toString();
|
|
||||||
boolean b = cfg.getBoolean("Members." + uuid + ".Permissions.CanBuild");
|
|
||||||
e.setCancelled(!b);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,33 +50,27 @@ public class BlockListener implements Listener {
|
|||||||
WorldPlayer wp = new WorldPlayer(p, worldname);
|
WorldPlayer wp = new WorldPlayer(p, worldname);
|
||||||
if (!wp.isOnSystemWorld())
|
if (!wp.isOnSystemWorld())
|
||||||
return;
|
return;
|
||||||
|
if(!wp.isMember())
|
||||||
|
return;
|
||||||
if (!wp.isOwnerofWorld()) {
|
if (!wp.isOwnerofWorld()) {
|
||||||
File file = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
|
e.setCancelled(!wp.canBuild());
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
|
||||||
String uuid = p.getUniqueId().toString();
|
|
||||||
boolean b = cfg.getBoolean("Members." + uuid + ".Permissions.CanBuild");
|
|
||||||
e.setCancelled(!b);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFire(BlockIgniteEvent e) {
|
public void onFire(BlockIgniteEvent e) {
|
||||||
World w = e.getBlock().getWorld();
|
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
|
||||||
File file = new File(Bukkit.getWorldContainer(), w.getName() + "/worldconfig.yml");
|
if(!file.exists())
|
||||||
if (file.exists()) {
|
return;
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
|
||||||
boolean b = cfg.getBoolean("Settings.Fire");
|
e.setCancelled(!wc.isFire());
|
||||||
e.setCancelled(!b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFire(BlockBurnEvent e) {
|
public void onFire(BlockBurnEvent e) {
|
||||||
World w = e.getBlock().getWorld();
|
File file = WorldConfig.getWorldFile(e.getBlock().getWorld().getName());
|
||||||
File file = new File(Bukkit.getWorldContainer(), w.getName() + "/worldconfig.yml");
|
if(!file.exists())
|
||||||
if (file.exists()) {
|
return;
|
||||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
WorldConfig wc = WorldConfig.getWorldConfig(e.getBlock().getWorld().getName());
|
||||||
boolean b = cfg.getBoolean("Settings.Fire");
|
e.setCancelled(!wc.isFire());
|
||||||
e.setCancelled(!b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package de.butzlabben.world.wrapper;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.WorldCreator;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
|
import com.boydti.fawe.bukkit.wrapper.AsyncWorld;
|
||||||
|
import com.boydti.fawe.util.TaskManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Butzlabben
|
||||||
|
* @since 08.06.2018
|
||||||
|
*/
|
||||||
|
public class AsyncCreatorAdapter implements CreatorAdapter{
|
||||||
|
|
||||||
|
// Create worlds async to close #16
|
||||||
|
@Override
|
||||||
|
public void create(WorldCreator creator) {
|
||||||
|
TaskManager.IMP.async(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// Create or load a world async with the provided WorldCreator settings
|
||||||
|
AsyncWorld world = AsyncWorld.create(creator);
|
||||||
|
// AsyncWorld world = AsyncWorld.wrap(bukkitWorld); // Or wrap existing world
|
||||||
|
Block block = world.getBlockAt(0, 0, 0);
|
||||||
|
block.setType(Material.BEDROCK);
|
||||||
|
// When you are done
|
||||||
|
world.commit();
|
||||||
|
|
||||||
|
Bukkit.getWorlds().add(world);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package de.butzlabben.world.wrapper;
|
||||||
|
|
||||||
|
import org.bukkit.WorldCreator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Butzlabben
|
||||||
|
* @since 07.06.2018
|
||||||
|
*/
|
||||||
|
public interface CreatorAdapter {
|
||||||
|
|
||||||
|
public void create(WorldCreator creator);
|
||||||
|
}
|
@ -212,8 +212,9 @@ public class SystemWorld {
|
|||||||
world.renameTo(new File(Bukkit.getWorldContainer(), myName.toString()));
|
world.renameTo(new File(Bukkit.getWorldContainer(), myName.toString()));
|
||||||
worldname = myName.toString();
|
worldname = myName.toString();
|
||||||
}
|
}
|
||||||
// Teleport the Player
|
// For #16
|
||||||
|
WorldSystem.creator.create(new WorldCreator(worldname));
|
||||||
|
|
||||||
World worldinserver = Bukkit.createWorld(new WorldCreator(worldname));
|
World worldinserver = Bukkit.createWorld(new WorldCreator(worldname));
|
||||||
Bukkit.getServer().getWorlds().add(worldinserver);
|
Bukkit.getServer().getWorlds().add(worldinserver);
|
||||||
w = worldinserver;
|
w = worldinserver;
|
||||||
@ -307,9 +308,11 @@ public class SystemWorld {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
World worldinserver = Bukkit.createWorld(event.getWorldCreator());
|
//For #16
|
||||||
Bukkit.getServer().getWorlds().add(worldinserver);
|
WorldSystem.creator.create(event.getWorldCreator());
|
||||||
|
|
||||||
|
// World worldinserver = Bukkit.createWorld(event.getWorldCreator());
|
||||||
|
// Bukkit.getServer().getWorlds().add(worldinserver);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
name: WorldSystem
|
name: WorldSystem
|
||||||
version: 2.1.2
|
version: 2.1.2.2
|
||||||
author: Butzlabben
|
author: Butzlabben
|
||||||
main: de.butzlabben.world.WorldSystem
|
main: de.butzlabben.world.WorldSystem
|
||||||
|
loadbefore: [FastAsyncWorldEdit, WorldEdit]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
ws:
|
ws:
|
||||||
|
Loading…
Reference in New Issue
Block a user