Some more basics etc...
This commit is contained in:
parent
4fd9821c79
commit
3f678fcd36
|
@ -0,0 +1,5 @@
|
||||||
|
package com.onarandombox.MultiVerseCore;
|
||||||
|
|
||||||
|
public class MVBlockListener {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.onarandombox.MultiVerseCore;
|
||||||
|
|
||||||
|
public class MVEntityListener {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.onarandombox.MultiVerseCore;
|
||||||
|
|
||||||
|
public class MVPlayerListener {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.onarandombox.MultiVerseCore;
|
||||||
|
|
||||||
|
public class MVPluginListener {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.onarandombox.MultiVerseCore;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
|
import org.bukkit.util.config.Configuration;
|
||||||
|
|
||||||
|
import com.onarandombox.utils.stringLocation;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class MVWorld {
|
||||||
|
|
||||||
|
private MultiVerseCore plugin; // Hold the Plugin Instance.
|
||||||
|
private Configuration config; // Hold the Configuration File.
|
||||||
|
|
||||||
|
public World world; // The World Instance.
|
||||||
|
public Environment environment; // Hold the Environment type EG Environment.NETHER / Environment.NORMAL
|
||||||
|
public Location spawn; // Location of the Spawn Point.
|
||||||
|
|
||||||
|
public String name; // The Worlds Name, EG its folder name.
|
||||||
|
public String alias = ""; // Short Alias for the World, this will be used in Chat Prefixes.
|
||||||
|
|
||||||
|
public Boolean animals; // Does this World allow Animals to Spawn?
|
||||||
|
public Boolean monsters; // Does this World allow Monsters to Spawn?
|
||||||
|
public Boolean pvp; // Does this World allow PVP?
|
||||||
|
|
||||||
|
public List<String> blockBlacklist; // Contain a list of Blocks which we won't allow on this World.
|
||||||
|
public List<String> joinWhitelist; // Contain a list of Players/Groups which can join this World.
|
||||||
|
public List<String> joinBlacklist; // Contain a list of Players/Groups which cannot join this World.
|
||||||
|
public List<String> editWhitelist; // Contain a list of Players/Groups which can edit this World. (Place/Destroy Blocks)
|
||||||
|
public List<String> editBlacklist; // Contain a list of Players/Groups which cannot edit this World. (Place/Destroy Blocks)
|
||||||
|
public List<String> worldBlacklist; // Contain a list of Worlds which Players cannot use to Portal to this World.
|
||||||
|
|
||||||
|
public MVWorld(World world, Configuration config, MultiVerseCore instance){
|
||||||
|
this.config = config;
|
||||||
|
this.plugin = instance;
|
||||||
|
|
||||||
|
this.world = world;
|
||||||
|
this.name = world.getName();
|
||||||
|
|
||||||
|
this.alias = config.getString("worlds." + this.name + ".alias","");
|
||||||
|
|
||||||
|
this.environment = world.getEnvironment();
|
||||||
|
|
||||||
|
this.spawn = getSpawn(this.config.getString("worlds." + name + ".spawn", "").split(":"));
|
||||||
|
|
||||||
|
this.monsters = config.getBoolean("worlds." + this.name + ".monsters", true);
|
||||||
|
this.animals = config.getBoolean("worlds." + this.name + ".animals", true);
|
||||||
|
this.pvp = config.getBoolean("worlds." + this.name + ".pvp", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Location getSpawn(String[] spawn){
|
||||||
|
Location l = null;
|
||||||
|
|
||||||
|
if(spawn.length!=5){
|
||||||
|
return this.world.getSpawnLocation();
|
||||||
|
} else {
|
||||||
|
return new stringLocation().stringToLocation(world, spawn[0], spawn[1], spawn[2], spawn[3], spawn[4]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.onarandombox.MultiVerseCore;
|
package com.onarandombox.MultiVerseCore;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
@ -19,36 +20,35 @@ import com.nijikokun.bukkit.iConomy.iConomy;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class MultiVerseCore extends JavaPlugin {
|
public class MultiVerseCore extends JavaPlugin {
|
||||||
/**
|
// Variable to state whether we are displaying Debug Messages or not.
|
||||||
* Variable for whether we are going to allow Debug Messages or not.
|
|
||||||
*/
|
|
||||||
public boolean debug = false;
|
public boolean debug = false;
|
||||||
/**
|
|
||||||
* Variable to hold the Server Instance.
|
// Useless stuff to keep us going.
|
||||||
*/
|
|
||||||
public static Server server;
|
|
||||||
/**
|
|
||||||
* Permissions Plugin
|
|
||||||
*/
|
|
||||||
public static PermissionHandler Permissions = null;
|
|
||||||
/**
|
|
||||||
* Setup the Logger, also set a public variable which contains the prefix
|
|
||||||
* for all log messages, this allows for easy change.
|
|
||||||
*/
|
|
||||||
private final Logger log = Logger.getLogger("Minecraft");
|
private final Logger log = Logger.getLogger("Minecraft");
|
||||||
public final String logPrefix = "[MultiVerse-Core] ";
|
public final String logPrefix = "[MultiVerse-Core] ";
|
||||||
/**
|
|
||||||
* Variable to hold the Plugin instance.
|
|
||||||
*/
|
|
||||||
public static Plugin instance;
|
public static Plugin instance;
|
||||||
/**
|
public static Server server;
|
||||||
* Variable to hold the Plugins Description
|
|
||||||
*/
|
|
||||||
public static PluginDescriptionFile description;
|
public static PluginDescriptionFile description;
|
||||||
|
|
||||||
|
// Permissions Handler
|
||||||
|
public static PermissionHandler Permissions = null;
|
||||||
|
|
||||||
|
// Configurations
|
||||||
|
public static Configuration configMV;
|
||||||
|
public static Configuration configWorlds;
|
||||||
|
|
||||||
|
// Setup the block/player/entity listener.
|
||||||
|
private MVPlayerListener playerListener;
|
||||||
|
private MVBlockListener blockListener;
|
||||||
|
private MVEntityListener entityListener;
|
||||||
|
private MVPluginListener pluginListener;
|
||||||
|
|
||||||
|
// HashMap to contain all the Worlds which this Plugin will manage.
|
||||||
|
public HashMap<String,MVWorld> mvWorlds = new HashMap<String,MVWorld>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What happens when the plugin gets around to be enabled...
|
* What happens when the plugin gets around to be enabled...
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
this.getDataFolder().mkdir();
|
this.getDataFolder().mkdir();
|
||||||
/**
|
/**
|
||||||
|
@ -59,15 +59,14 @@ public class MultiVerseCore extends JavaPlugin {
|
||||||
/**
|
/**
|
||||||
* What happens when the plugin gets disabled...
|
* What happens when the plugin gets disabled...
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
log.info(logPrefix + "- Disabled");
|
log.info(logPrefix + "- Disabled");
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* onCommand
|
* onCommand
|
||||||
*/
|
*/
|
||||||
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
|
||||||
return debug;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Basic Debug Output function, if we've enabled debugging we'll output more information.
|
* Basic Debug Output function, if we've enabled debugging we'll output more information.
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.onarandombox.utils;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
public class stringLocation {
|
||||||
|
|
||||||
|
public Location stringToLocation(World world, String xStr, String yStr, String zStr, String yawStr, String pitchStr){
|
||||||
|
double x = Double.parseDouble(xStr);
|
||||||
|
double y = Double.parseDouble(yStr);
|
||||||
|
double z = Double.parseDouble(zStr);
|
||||||
|
float yaw = Float.valueOf(yawStr).floatValue();
|
||||||
|
float pitch = Float.valueOf(pitchStr).floatValue();
|
||||||
|
|
||||||
|
return new Location(world, x, y, z, yaw, pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String locationToString(Location location) {
|
||||||
|
StringBuilder l = new StringBuilder();
|
||||||
|
l.append(location.getBlockX() + ":");
|
||||||
|
l.append(location.getBlockY() + ":");
|
||||||
|
l.append(location.getBlockZ() + ":");
|
||||||
|
l.append(location.getYaw() + ":");
|
||||||
|
l.append(location.getPitch());
|
||||||
|
return l.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue