mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-29 05:55:48 +01:00
Add mvdelete, mvremove and mvunload
This commit is contained in:
parent
8e41d2ea4b
commit
6afd8dfdfb
BIN
lib/Essentials.jar
Normal file
BIN
lib/Essentials.jar
Normal file
Binary file not shown.
BIN
lib/Permissions.jar
Normal file
BIN
lib/Permissions.jar
Normal file
Binary file not shown.
BIN
lib/craftbukkit-0.0.1-SNAPSHOT.jar
Normal file
BIN
lib/craftbukkit-0.0.1-SNAPSHOT.jar
Normal file
Binary file not shown.
BIN
lib/iConomy.jar
Normal file
BIN
lib/iConomy.jar
Normal file
Binary file not shown.
4
lib/update.sh
Executable file
4
lib/update.sh
Executable file
@ -0,0 +1,4 @@
|
||||
wget -N http://ci.bukkit.org/job/dev-CraftBukkit/lastSuccessfulBuild/artifact/target/craftbukkit-0.0.1-SNAPSHOT.jar
|
||||
wget -N http://www.theyeticave.net/downloads/permissions/3.1.5/Permissions.jar
|
||||
wget -N http://earth2me.net:8001/artifactory/essentials-2.2/Essentials.jar
|
||||
wget -N http://mirror.nexua.org/iConomy/JARS/5.0/1/iConomy.jar
|
@ -6,8 +6,10 @@ import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
|
||||
@ -28,6 +30,15 @@ public class MVEntityListener extends EntityListener {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
if(event.getEntity() instanceof Player) {
|
||||
Player p = (Player)event.getEntity();
|
||||
p.sendMessage("You died!");
|
||||
}
|
||||
super.onEntityDeath(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Animal/Monster Spawn settings, seems like a more concrete method than using CraftBukkit.
|
||||
*/
|
||||
|
@ -30,12 +30,16 @@ public class MVPlayerListener extends PlayerListener {
|
||||
// MultiVerseCore.log.info("2 - " + event.getPlayer().getLocation().toString());
|
||||
MVPlayerSession ps = this.plugin.getPlayerSession(event.getPlayer());
|
||||
ps.setRespawnWorld(event.getTo().getWorld());
|
||||
|
||||
log.warning("To: " + event.getTo().getWorld().getName());
|
||||
log.warning("From: " + event.getFrom().getWorld().getName());
|
||||
}
|
||||
|
||||
public void onPlayerKick(PlayerKickEvent event) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
Player p = event.getPlayer(); // Grab Player
|
||||
|
@ -28,7 +28,7 @@ public class MVWorld {
|
||||
|
||||
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<Integer> 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)
|
||||
@ -56,7 +56,7 @@ public class MVWorld {
|
||||
this.joinWhitelist = config.getStringList("worlds." + name + ".playerWhitelist", joinWhitelist);
|
||||
this.joinBlacklist = config.getStringList("worlds." + name + ".playerBlacklist", joinBlacklist);
|
||||
this.worldBlacklist = config.getStringList("worlds." + name + ".worldBlacklist", worldBlacklist);
|
||||
this.blockBlacklist = config.getStringList("worlds." + name + ".blockBlacklist", blockBlacklist);
|
||||
this.blockBlacklist = config.getIntList("worlds." + name + ".blockBlacklist", blockBlacklist);
|
||||
this.editWhitelist = config.getStringList("worlds." + name + ".editWhitelist", editWhitelist);
|
||||
this.editBlacklist = config.getStringList("worlds." + name + ".editBlacklist", editBlacklist);
|
||||
|
||||
@ -77,11 +77,13 @@ public class MVWorld {
|
||||
}
|
||||
|
||||
config.save();
|
||||
if (config.getIntList("worlds." + name + ".blockBlacklist", new ArrayList<Integer>()).size() == 0) {
|
||||
addSampleData();
|
||||
}
|
||||
}
|
||||
|
||||
private void initLists() {
|
||||
blockBlacklist = new ArrayList<String>();
|
||||
blockBlacklist = new ArrayList<Integer>();
|
||||
joinWhitelist = new ArrayList<String>();
|
||||
joinBlacklist = new ArrayList<String>();
|
||||
editWhitelist = new ArrayList<String>();
|
||||
@ -94,7 +96,7 @@ public class MVWorld {
|
||||
|
||||
this.animalList.add("pig");
|
||||
|
||||
this.blockBlacklist.add("49");
|
||||
this.blockBlacklist.add(49);
|
||||
|
||||
this.joinWhitelist.add("fernferret");
|
||||
this.joinWhitelist.add("g:Admins");
|
||||
|
@ -44,17 +44,19 @@ import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import com.onarandombox.MultiverseCore.command.CommandManager;
|
||||
import com.onarandombox.MultiverseCore.command.commands.CoordCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.HelpCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.ListCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.CreateCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.DeleteCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.HelpCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.ImportCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.SpawnCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.ListCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.RemoveCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.SetSpawnCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.WhoCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.SpawnCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.TeleportCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.UnloadCommand;
|
||||
import com.onarandombox.MultiverseCore.command.commands.WhoCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.MVModify;
|
||||
import com.onarandombox.MultiverseCore.commands.MVReload;
|
||||
import com.onarandombox.MultiverseCore.commands.MVRemove;
|
||||
import com.onarandombox.MultiverseCore.configuration.DefaultConfiguration;
|
||||
import com.onarandombox.utils.DebugLog;
|
||||
import com.onarandombox.utils.Messaging;
|
||||
@ -300,6 +302,9 @@ public class MultiverseCore extends JavaPlugin {
|
||||
commandManager.addCommand(new CreateCommand(this));
|
||||
commandManager.addCommand(new ImportCommand(this));
|
||||
commandManager.addCommand(new SpawnCommand(this));
|
||||
commandManager.addCommand(new RemoveCommand(this));
|
||||
commandManager.addCommand(new DeleteCommand(this));
|
||||
commandManager.addCommand(new UnloadCommand(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -308,7 +313,7 @@ public class MultiverseCore extends JavaPlugin {
|
||||
private void setupCommands() {
|
||||
// commands.put("mvcreate", new CreateCommand(this));
|
||||
// commands.put("mvimport", new ImportCommand(this));
|
||||
commands.put("mvremove", new MVRemove(this));
|
||||
// commands.put("mvremove", new RemoveCommand(this));
|
||||
commands.put("mvmodify", new MVModify(this));
|
||||
// commands.put("mvtp", new TeleportCommand(this));
|
||||
// commands.put("mvlist", new ListCommand(this));
|
||||
@ -437,7 +442,13 @@ public class MultiverseCore extends JavaPlugin {
|
||||
addWorld(name, environment, null);
|
||||
}
|
||||
|
||||
public boolean removeWorld(String name) {
|
||||
/**
|
||||
* Remove the world from the Multiverse list
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
public boolean unloadWorld(String name) {
|
||||
if (worlds.containsKey(name)) {
|
||||
worlds.remove(name);
|
||||
return true;
|
||||
@ -445,6 +456,56 @@ public class MultiverseCore extends JavaPlugin {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list and from the config
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
public boolean removeWorld(String name) {
|
||||
unloadWorld(name);
|
||||
configWorlds.removeProperty("worlds." + name);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the world from the Multiverse list, from the config and deletes the folder
|
||||
*
|
||||
* @param name The name of the world to remove
|
||||
* @return True if success, false if failure.
|
||||
*/
|
||||
public boolean deleteWorld(String name) {
|
||||
unloadWorld(name);
|
||||
removeWorld(name);
|
||||
if (getServer().unloadWorld(name, false)) {
|
||||
return deleteFolder(new File(name));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a folder Courtesy of: lithium3141
|
||||
*
|
||||
* @param file The folder to delete
|
||||
* @return true if success
|
||||
*/
|
||||
private boolean deleteFolder(File file) {
|
||||
if (file.exists()) {
|
||||
// If the file exists, and it has more than one file in it.
|
||||
if (file.isDirectory()) {
|
||||
for (File f : file.listFiles()) {
|
||||
if (!this.deleteFolder(f)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
file.delete();
|
||||
return !file.exists();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* What happens when the plugin gets disabled...
|
||||
*/
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.onarandombox.MultiverseCore.command.commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
||||
|
||||
public class DeleteCommand extends BaseCommand {
|
||||
|
||||
public DeleteCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
name = "Delete World";
|
||||
description = "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY.";
|
||||
usage = "/mvdelete" + ChatColor.GREEN + " {WORLD} ";
|
||||
minArgs = 1;
|
||||
maxArgs = 1;
|
||||
identifiers.add("mvdelete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (plugin.deleteWorld(args[0])) {
|
||||
sender.sendMessage("World Deleted!");
|
||||
} else {
|
||||
sender.sendMessage("Error trying to delete World!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.onarandombox.MultiverseCore.command.commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
||||
|
||||
public class RemoveCommand extends BaseCommand {
|
||||
|
||||
public RemoveCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
name = "Remove World";
|
||||
description = "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder.";
|
||||
usage = "/mvremove" + ChatColor.GREEN + " {WORLD} ";
|
||||
minArgs = 1;
|
||||
maxArgs = 1;
|
||||
identifiers.add("mvremove");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (plugin.removeWorld(args[0])) {
|
||||
sender.sendMessage("World removed from config!");
|
||||
} else {
|
||||
sender.sendMessage("Error trying to remove world from config!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.onarandombox.MultiverseCore.command.commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
||||
|
||||
public class UnloadCommand extends BaseCommand {
|
||||
|
||||
public UnloadCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
name = "Unload World";
|
||||
description = "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.";
|
||||
usage = "/mvunload" + ChatColor.GREEN + " {WORLD} ";
|
||||
minArgs = 1;
|
||||
maxArgs = 1;
|
||||
identifiers.add("mvunload");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (plugin.unloadWorld(args[0])) {
|
||||
sender.sendMessage("World Unloaded!");
|
||||
} else {
|
||||
sender.sendMessage("Error trying to unload world!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVCommandHandler;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
||||
public class MVRemove extends MVCommandHandler {
|
||||
|
||||
public MVRemove(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean perform(CommandSender sender, String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -19,11 +19,17 @@ commands:
|
||||
/<command> creative normal -- Imports an existing world called 'creative' with a NORMAL environment.
|
||||
/<command> hellworld nether -- Imports an existing world called 'hellworld' with a NETHER environment.
|
||||
mvremove:
|
||||
description: World remove command
|
||||
usage: |
|
||||
/<command> <world>
|
||||
mvdelete:
|
||||
description: World delete command
|
||||
usage: |
|
||||
/<command> <world>
|
||||
/<command> creative -- Removes the world 'creative' from the MultiVerse setup.
|
||||
/<command> hellworld -- Removes the world 'hellworld' from the MultiVerse setup.
|
||||
mvunload:
|
||||
description: World unload command
|
||||
usage: |
|
||||
/<command> <world>
|
||||
mvmodify:
|
||||
description: Modify the settings of an existing world
|
||||
usage: |
|
||||
|
Loading…
Reference in New Issue
Block a user