mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 18:47:20 +01:00
Merge remote-tracking branch 'upstream/master' into HEAD
Conflicts: src/com/onarandombox/MultiverseCore/command/commands/CreateCommand.java src/com/onarandombox/MultiverseCore/command/commands/HelpCommand.java src/com/onarandombox/MultiverseCore/command/commands/ModifyAddCommand.java src/com/onarandombox/MultiverseCore/command/commands/ModifyClearCommand.java src/com/onarandombox/MultiverseCore/command/commands/ModifyRemoveCommand.java src/com/onarandombox/MultiverseCore/command/commands/ModifySetCommand.java src/com/onarandombox/MultiverseCore/command/commands/SpawnCommand.java src/com/onarandombox/MultiverseCore/command/commands/WhoCommand.java src/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java src/com/onarandombox/MultiverseCore/commands/ImportCommand.java src/com/onarandombox/MultiverseCore/commands/ListCommand.java
This commit is contained in:
commit
935f987a4d
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
|||||||
[submodule "lib/allpay"]
|
[submodule "lib/allpay"]
|
||||||
path = lib/allpay
|
path = lib/allpay
|
||||||
url = git://github.com/FernFerret/AllPay.git
|
url = git://github.com/FernFerret/AllPay.git
|
||||||
|
[submodule "lib/commandhandler"]
|
||||||
|
path = lib/commandhandler
|
||||||
|
url = git://github.com/PneumatiCraft/CommandHandler.git
|
||||||
|
1
COPYING
1
COPYING
@ -1 +0,0 @@
|
|||||||
This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
|
|
@ -1,3 +1,5 @@
|
|||||||
This will do as a README for now -
|
Copyright (c) 2011, The Multiverse Team All rights reserved.
|
||||||
|
|
||||||
This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the FernFerret Studios nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -1 +1 @@
|
|||||||
Subproject commit a1624c1ed3977fc3170df5e5b847355e1e054e11
|
Subproject commit 48f6246236f4186db020696bfdcc43ce3abea915
|
1
lib/commandhandler
Submodule
1
lib/commandhandler
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit c1f179e22aae2b4216b253cfe9f1ee7837728edd
|
114
src/com/onarandombox/MultiverseCore/MVConfigMigrator.java
Normal file
114
src/com/onarandombox/MultiverseCore/MVConfigMigrator.java
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
package com.onarandombox.MultiverseCore;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.util.config.Configuration;
|
||||||
|
|
||||||
|
public class MVConfigMigrator {
|
||||||
|
private MultiverseCore core;
|
||||||
|
|
||||||
|
public MVConfigMigrator(MultiverseCore core) {
|
||||||
|
this.core = core;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean migrate(String name, File folder) {
|
||||||
|
File oldFolder = null;
|
||||||
|
|
||||||
|
// They still have MV 1 installed! Good!
|
||||||
|
if (this.core.getServer().getPluginManager().getPlugin("MultiVerse") != null) {
|
||||||
|
this.core.log(Level.INFO, "Found MultiVerse 1. Starting Config Migration...");
|
||||||
|
if (!this.core.getServer().getPluginManager().isPluginEnabled("MultiVerse")) {
|
||||||
|
Plugin plugin = this.core.getServer().getPluginManager().getPlugin("MultiVerse");
|
||||||
|
oldFolder = plugin.getDataFolder();
|
||||||
|
this.core.getServer().getPluginManager().disablePlugin(plugin);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// They didn't have MV 1 enabled... let's try and find the folder...
|
||||||
|
File[] folders = folder.getParentFile().listFiles();
|
||||||
|
List<File> folderList = Arrays.asList(folders);
|
||||||
|
for (File f : folderList) {
|
||||||
|
if (f.getName().equalsIgnoreCase("MultiVerse")) {
|
||||||
|
this.core.log(Level.INFO, "Found the MultiVerse 1 config folder. Starting Config Migration...");
|
||||||
|
oldFolder = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (oldFolder == null) {
|
||||||
|
this.core.log(Level.INFO, "Did not find the MV1 Folder. If you did not have MultiVerse 1 installed and this is the FIRST time you're running MV2, this message is GOOD. ");
|
||||||
|
this.core.log(Level.INFO, "If you did, your configs were **NOT** migrated! Go Here: INSERTURLFORHELP");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.equalsIgnoreCase("worlds.yml")) {
|
||||||
|
return this.migrateWorlds(name, oldFolder, folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.equalsIgnoreCase("config.yml")) {
|
||||||
|
return this.migrateMainConfig(name, oldFolder, folder);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean migrateWorlds(String name, File oldFolder, File newFolder) {
|
||||||
|
Configuration newConfig = new Configuration(new File(newFolder, "worlds.yml"));
|
||||||
|
this.core.log(Level.INFO, "Trying to migrate worlds.yml...");
|
||||||
|
Configuration oldConfig = new Configuration(new File(oldFolder, "worlds.yml"));
|
||||||
|
oldConfig.load();
|
||||||
|
List<String> keys = oldConfig.getKeys("worlds");
|
||||||
|
if (keys == null) {
|
||||||
|
this.core.log(Level.WARNING, "Migration FAILURE!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (String key : keys) {
|
||||||
|
newConfig.setProperty("worlds." + key + ".animals.spawn", oldConfig.getProperty("worlds." + key + ".animals"));
|
||||||
|
newConfig.setProperty("worlds." + key + ".monsters.spawn", oldConfig.getProperty("worlds." + key + ".mobs"));
|
||||||
|
newConfig.setProperty("worlds." + key + ".pvp", oldConfig.getProperty("worlds." + key + ".pvp"));
|
||||||
|
newConfig.setProperty("worlds." + key + ".alias.name", oldConfig.getProperty("worlds." + key + ".alias"));
|
||||||
|
newConfig.setProperty("worlds." + key + ".tempspawn", oldConfig.getProperty("worlds." + key + ".spawn"));
|
||||||
|
newConfig.setProperty("worlds." + key + ".price", oldConfig.getProperty("worlds." + key + ".price"));
|
||||||
|
newConfig.setProperty("worlds." + key + ".environment", oldConfig.getProperty("worlds." + key + ".environment"));
|
||||||
|
// Have to convert CSLs to arrays
|
||||||
|
migrateListItem(newConfig, oldConfig, key, ".blockBlacklist", ".blockblacklist");
|
||||||
|
migrateListItem(newConfig, oldConfig, key, ".worldBlacklist", ".worldblacklist");
|
||||||
|
migrateListItem(newConfig, oldConfig, key, ".playerBlacklist", ".playerblacklist");
|
||||||
|
migrateListItem(newConfig, oldConfig, key, ".playerWhitelist", ".playerwhitelist");
|
||||||
|
}
|
||||||
|
newConfig.save();
|
||||||
|
this.core.log(Level.INFO, "Migration SUCCESS!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void migrateListItem(Configuration newConfig, Configuration oldConfig, String key, String oldProperty, String newProperty) {
|
||||||
|
List<String> list = Arrays.asList(oldConfig.getString("worlds." + key + oldProperty).split(","));
|
||||||
|
if (list.size() > 0) {
|
||||||
|
if (list.get(0).length() == 0) {
|
||||||
|
list = new ArrayList<String>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newConfig.setProperty("worlds." + key + newProperty, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean migrateMainConfig(String name, File oldFolder, File newFolder) {
|
||||||
|
Configuration newConfig = new Configuration(new File(newFolder, "config.yml"));
|
||||||
|
this.core.log(Level.INFO, "Migrating config.yml...");
|
||||||
|
Configuration oldConfig = new Configuration(new File(oldFolder, "MultiVerse.yml"));
|
||||||
|
oldConfig.load();
|
||||||
|
newConfig.setProperty("worldnameprefix", oldConfig.getProperty("prefix"));
|
||||||
|
newConfig.setProperty("messagecooldown", oldConfig.getProperty("alertcooldown"));
|
||||||
|
// Default values:
|
||||||
|
newConfig.setProperty("opfallback", true);
|
||||||
|
newConfig.setProperty("disableautoheal", false);
|
||||||
|
newConfig.setProperty("fakepvp", false);
|
||||||
|
newConfig.setProperty("bedrespawn", true);
|
||||||
|
newConfig.setProperty("version", 2.0);
|
||||||
|
newConfig.save();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -2,14 +2,20 @@ package com.onarandombox.MultiverseCore;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
import org.bukkit.entity.CreatureType;
|
import org.bukkit.entity.CreatureType;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Ghast;
|
import org.bukkit.entity.Ghast;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Slime;
|
import org.bukkit.entity.Slime;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityListener;
|
import org.bukkit.event.entity.EntityListener;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
@ -23,14 +29,64 @@ public class MVEntityListener extends EntityListener {
|
|||||||
public MVEntityListener(MultiverseCore plugin) {
|
public MVEntityListener(MultiverseCore plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event - When a Entity is Damaged, we first sort out whether it is of
|
||||||
|
* importance to us, such as EntityVSEntity or EntityVSProjectile. Then we
|
||||||
|
* grab the attacked and defender and check if its a player. Then deal with
|
||||||
|
* the PVP Aspect.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Entity attacker = null;
|
||||||
|
Entity defender = null;
|
||||||
|
if (event instanceof EntityDamageByEntityEvent) {
|
||||||
|
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event;
|
||||||
|
attacker = sub.getDamager();
|
||||||
|
defender = sub.getEntity();
|
||||||
|
} else if (event instanceof EntityDamageByProjectileEvent) {
|
||||||
|
EntityDamageByProjectileEvent sub = (EntityDamageByProjectileEvent) event;
|
||||||
|
attacker = sub.getDamager();
|
||||||
|
defender = sub.getEntity();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (attacker == null || defender == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (defender instanceof Player) {
|
||||||
|
Player player = (Player) defender;
|
||||||
|
World w = player.getWorld();
|
||||||
|
|
||||||
|
if (!this.plugin.isMVWorld(w.getName())) {
|
||||||
|
//if the world is not handled, we don't care
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MVWorld world = this.plugin.getMVWorld(w.getName());
|
||||||
|
|
||||||
|
if (attacker != null && attacker instanceof Player) {
|
||||||
|
Player pattacker = (Player) attacker;
|
||||||
|
|
||||||
|
|
||||||
|
if (!world.getPvp() && this.plugin.configMV.getBoolean("fakepvp", false)) {
|
||||||
|
pattacker.sendMessage(ChatColor.RED + "PVP is disabled in this World.");
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
||||||
if(event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RegainReason reason = event.getRegainReason();
|
RegainReason reason = event.getRegainReason();
|
||||||
if(reason == RegainReason.REGEN && this.plugin.configMV.getBoolean("disableautoheal", false)) {
|
if (reason == RegainReason.REGEN && this.plugin.configMV.getBoolean("disableautoheal", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,53 +3,120 @@ package com.onarandombox.MultiverseCore;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.nijiko.permissions.PermissionHandler;
|
import com.nijiko.permissions.PermissionHandler;
|
||||||
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
|
import com.pneumaticraft.commandhandler.PermissionsInterface;
|
||||||
|
|
||||||
|
public class MVPermissions implements PermissionsInterface {
|
||||||
|
|
||||||
public class MVPermissions {
|
|
||||||
|
|
||||||
private MultiverseCore plugin;
|
private MultiverseCore plugin;
|
||||||
public PermissionHandler permissions = null;
|
public PermissionHandler permissions = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor FTW
|
* Constructor FTW
|
||||||
*
|
*
|
||||||
* @param plugin Pass along the Core Plugin.
|
* @param plugin Pass along the Core Plugin.
|
||||||
*/
|
*/
|
||||||
public MVPermissions(MultiverseCore plugin) {
|
public MVPermissions(MultiverseCore plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
// We have to see if permissions was loaded before MV was
|
// We have to see if permissions was loaded before MV was
|
||||||
if(this.plugin.getServer().getPluginManager().getPlugin("Permissions") != null) {
|
if (this.plugin.getServer().getPluginManager().getPlugin("Permissions") != null) {
|
||||||
this.setPermissions(((com.nijikokun.bukkit.Permissions.Permissions)this.plugin.getServer().getPluginManager().getPlugin("Permissions")).getHandler());
|
this.setPermissions(((Permissions) this.plugin.getServer().getPluginManager().getPlugin("Permissions")).getHandler());
|
||||||
this.plugin.log(Level.INFO, "- Attached to Permissions");
|
this.plugin.log(Level.INFO, "- Attached to Permissions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use hasPermission() Now
|
* Check if a Player can teleport to the Destination world from there current world. This checks against the Worlds Blacklist
|
||||||
*
|
*
|
||||||
* @param p The player instance.
|
* @param p
|
||||||
* @param node The permission node we are checking against.
|
* @param w
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
public Boolean canTravelFromWorld(Player p, MVWorld w) {
|
||||||
public boolean has(Player p, String node) {
|
List<String> blackList = w.getWorldBlacklist();
|
||||||
boolean result = false;
|
|
||||||
|
boolean returnValue = true;
|
||||||
if (this.permissions != null) {
|
|
||||||
result = this.permissions.has(p, node);
|
if (blackList.size() == 0) {
|
||||||
} else if (p.isOp()) {
|
returnValue = true;
|
||||||
result = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
for (String s : blackList) {
|
||||||
|
if (s.equalsIgnoreCase(p.getWorld().getName())) {
|
||||||
|
returnValue = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the Player has the permissions to enter this world.
|
||||||
|
*
|
||||||
|
* @param p
|
||||||
|
* @param w
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Boolean canEnterWorld(Player p, MVWorld w) {
|
||||||
|
|
||||||
|
List<String> whiteList = w.getPlayerWhitelist();
|
||||||
|
List<String> blackList = w.getPlayerBlacklist();
|
||||||
|
boolean returnValue = true;
|
||||||
|
|
||||||
|
// If there's anyone in the whitelist, then the whitelist is ACTIVE, anyone not in it is blacklisted.
|
||||||
|
if (whiteList.size() > 0) {
|
||||||
|
returnValue = false;
|
||||||
|
}
|
||||||
|
for (String bls : blackList) {
|
||||||
|
if (bls.toLowerCase().contains("g:") && this.inGroup(p, w.getAlias(), bls.split(":")[1])) {
|
||||||
|
returnValue = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (bls.equalsIgnoreCase(p.getName())) {
|
||||||
|
returnValue = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String wls : whiteList) {
|
||||||
|
if (wls.toLowerCase().contains("g:") && this.inGroup(p, w.getAlias(), wls.split(":")[1])) {
|
||||||
|
returnValue = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (wls.equalsIgnoreCase(p.getName())) {
|
||||||
|
returnValue = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if a player is in a group.
|
||||||
|
*
|
||||||
|
* @param player The player to check
|
||||||
|
* @param worldName The world to check in
|
||||||
|
* @param group The group are we checking
|
||||||
|
* @return True if the player is in the group, false if not.
|
||||||
|
*/
|
||||||
|
private boolean inGroup(Player player, String worldName, String group) {
|
||||||
|
if (this.permissions != null) {
|
||||||
|
return this.permissions.inGroup(worldName, player.getName(), group);
|
||||||
|
} else {
|
||||||
|
return player.isOp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissions(PermissionHandler handler) {
|
||||||
|
this.permissions = handler;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasPermission(CommandSender sender, String node, boolean isOpRequired) {
|
public boolean hasPermission(CommandSender sender, String node, boolean isOpRequired) {
|
||||||
|
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -65,98 +132,9 @@ public class MVPermissions {
|
|||||||
// If the Player doesn't have Permissions and isn't an Op then
|
// If the Player doesn't have Permissions and isn't an Op then
|
||||||
// we return true if OP is not required, otherwise we return false
|
// we return true if OP is not required, otherwise we return false
|
||||||
// This allows us to act as a default permission guidance
|
// This allows us to act as a default permission guidance
|
||||||
|
|
||||||
// If they have the op fallback disabled, NO commands will work without a permissions plugin.
|
// If they have the op fallback disabled, NO commands will work without a permissions plugin.
|
||||||
return !isOpRequired && opFallback;
|
return !isOpRequired && opFallback;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a Player can teleport to the Destination world from there current world. This checks against the Worlds Blacklist
|
|
||||||
*
|
|
||||||
* @param p
|
|
||||||
* @param w
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Boolean canTravelFromWorld(Player p, World w) {
|
|
||||||
List<String> blackList = this.plugin.getMVWorld(w.getName()).getWorldBlacklist();
|
|
||||||
|
|
||||||
boolean returnValue = true;
|
|
||||||
|
|
||||||
if (blackList.size() == 0) {
|
|
||||||
returnValue = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String s : blackList) {
|
|
||||||
if (s.equalsIgnoreCase(p.getWorld().getName())) {
|
|
||||||
returnValue = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the Player has the permissions to enter this world.
|
|
||||||
*
|
|
||||||
* @param p
|
|
||||||
* @param w
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Boolean canEnterWorld(Player p, World w) {
|
|
||||||
|
|
||||||
if (!this.plugin.isMVWorld(w.getName())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
List<String> whiteList = this.plugin.getMVWorld(w.getName()).getPlayerWhitelist();
|
|
||||||
List<String> blackList = this.plugin.getMVWorld(w.getName()).getPlayerBlacklist();
|
|
||||||
boolean returnValue = true;
|
|
||||||
|
|
||||||
// I lied. You definitely want this. Sorry Rigby :( You were right. --FF
|
|
||||||
// If there's anyone in the whitelist, then the whitelist is ACTIVE, anyone not in it is blacklisted.
|
|
||||||
if (whiteList.size() > 0) {
|
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
for (String bls : blackList) {
|
|
||||||
if (bls.toLowerCase().contains("g:") && this.inGroup(p, w.getName(), bls.split(":")[1])) {
|
|
||||||
returnValue = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (bls.equalsIgnoreCase(p.getName())) {
|
|
||||||
returnValue = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (String wls : whiteList) {
|
|
||||||
if (wls.toLowerCase().contains("g:") && this.inGroup(p, w.getName(), wls.split(":")[1])) {
|
|
||||||
returnValue = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (wls.equalsIgnoreCase(p.getName())) {
|
|
||||||
returnValue = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return returnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if a player is in a group.
|
|
||||||
*
|
|
||||||
* @param player The player to check
|
|
||||||
* @param worldName The world to check in
|
|
||||||
* @param group The group are we checking
|
|
||||||
* @return True if the player is in the group, false if not.
|
|
||||||
*/
|
|
||||||
private boolean inGroup(Player player, String worldName, String group) {
|
|
||||||
if (this.permissions != null) {
|
|
||||||
return this.permissions.inGroup(worldName, player.getName(), group);
|
|
||||||
} else {
|
|
||||||
return player.isOp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPermissions(PermissionHandler handler) {
|
|
||||||
this.permissions = handler;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,29 @@
|
|||||||
package com.onarandombox.MultiverseCore;
|
package com.onarandombox.MultiverseCore;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.event.MVRespawnEvent;
|
import com.onarandombox.MultiverseCore.event.MVRespawnEvent;
|
||||||
|
|
||||||
public class MVPlayerListener extends PlayerListener {
|
public class MVPlayerListener extends PlayerListener {
|
||||||
MultiverseCore plugin;
|
MultiverseCore plugin;
|
||||||
|
MVTeleport mvteleporter;
|
||||||
|
|
||||||
public MVPlayerListener(MultiverseCore plugin) {
|
public MVPlayerListener(MultiverseCore plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
|
||||||
MVPlayerSession ps = this.plugin.getPlayerSession(event.getPlayer());
|
|
||||||
ps.setRespawnWorld(event.getTo().getWorld());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayerKick(PlayerKickEvent event) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
super.onPlayerKick(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
Player p = event.getPlayer(); // Grab Player
|
Player p = event.getPlayer(); // Grab Player
|
||||||
@ -47,12 +38,20 @@ public class MVPlayerListener extends PlayerListener {
|
|||||||
ps.loc = loc; // Update the Players Session to the new Location.
|
ps.loc = loc; // Update the Players Session to the new Location.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerBedLeave(PlayerBedLeaveEvent event) {
|
||||||
|
Location bedLoc = event.getBed().getLocation();
|
||||||
|
bedLoc = this.plugin.getTeleporter().getSafeBedDestination(bedLoc);
|
||||||
|
this.plugin.getPlayerSession(event.getPlayer()).setRespawnLocation(bedLoc);
|
||||||
|
event.getPlayer().sendMessage("You should come back here when you type '/mv sleep'!");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerChat(PlayerChatEvent event) {
|
public void onPlayerChat(PlayerChatEvent event) {
|
||||||
// Not sure if this should be a seperat plugin... in here for now!!!
|
// Not sure if this should be a separate plugin... in here for now!!!
|
||||||
// FernFerret
|
// FernFerret
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -60,52 +59,55 @@ public class MVPlayerListener extends PlayerListener {
|
|||||||
* Check whether the Server is set to prefix the chat with the World name. If not we do nothing, if so we need to check if the World has an Alias.
|
* Check whether the Server is set to prefix the chat with the World name. If not we do nothing, if so we need to check if the World has an Alias.
|
||||||
*/
|
*/
|
||||||
if (this.plugin.configMV.getBoolean("worldnameprefix", true)) {
|
if (this.plugin.configMV.getBoolean("worldnameprefix", true)) {
|
||||||
|
|
||||||
String world = event.getPlayer().getWorld().getName();
|
String world = event.getPlayer().getWorld().getName();
|
||||||
|
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
|
|
||||||
// If we're not a MV world, don't do anything
|
// If we're not a MV world, don't do anything
|
||||||
if (!this.plugin.isMVWorld(world)) {
|
if (!this.plugin.isMVWorld(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MVWorld mvworld = this.plugin.getMVWorld(world);
|
MVWorld mvworld = this.plugin.getMVWorld(world);
|
||||||
prefix = mvworld.getColoredWorldString();
|
prefix = mvworld.getColoredWorldString();
|
||||||
|
|
||||||
String format = event.getFormat();
|
String format = event.getFormat();
|
||||||
|
|
||||||
event.setFormat("[" + prefix + "]" + format);
|
event.setFormat("[" + prefix + "]" + format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
// TODO: Handle Global Respawn from config
|
// TODO: Reimplement bed respawning, needs to be a way to persist the bed location or something otherwise it's not very effective.
|
||||||
|
|
||||||
// TODO: Handle Alternate Respawn from config
|
World world = event.getPlayer().getWorld();
|
||||||
|
|
||||||
MVPlayerSession ps = this.plugin.getPlayerSession(event.getPlayer());
|
// If it's not a World MV manages we stop.
|
||||||
// Location newrespawn = ps.getRespawnWorld().getSpawnLocation();
|
if (!this.plugin.isMVWorld(world.getName())) {
|
||||||
Location newrespawn = event.getPlayer().getWorld().getSpawnLocation();
|
return;
|
||||||
String respawnStyle = this.plugin.configMV.getString("notchrespawnstyle", "none");
|
|
||||||
String defaultWorld = this.plugin.configMV.getString("defaultspawnworld", "world");
|
|
||||||
|
|
||||||
if (respawnStyle.equalsIgnoreCase("none")) {
|
|
||||||
event.setRespawnLocation(newrespawn);
|
|
||||||
} else if (respawnStyle.equalsIgnoreCase("default")) {
|
|
||||||
|
|
||||||
if (this.plugin.isMVWorld(defaultWorld)) {
|
|
||||||
event.setRespawnLocation(this.plugin.getServer().getWorld(defaultWorld).getSpawnLocation());
|
|
||||||
} else {
|
|
||||||
event.setRespawnLocation(newrespawn);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
MVRespawnEvent mvevent = new MVRespawnEvent(newrespawn, event.getPlayer(), respawnStyle);
|
|
||||||
this.plugin.getServer().getPluginManager().callEvent(mvevent);
|
|
||||||
event.setRespawnLocation(mvevent.getPlayersRespawnLocation());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the MVWorld
|
||||||
|
MVWorld mvWorld = this.plugin.getMVWorld(world.getName());
|
||||||
|
// Get the instance of the World the player should respawn at.
|
||||||
|
MVWorld respawnWorld = null;
|
||||||
|
if (this.plugin.isMVWorld(mvWorld.getRespawnToWorld())) {
|
||||||
|
respawnWorld = this.plugin.getMVWorld(mvWorld.getRespawnToWorld());
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it's null then it either means the World doesn't exist or the value is blank, so we don't handle it.
|
||||||
|
if (respawnWorld == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Location respawnLocation = respawnWorld.getCBWorld().getSpawnLocation();
|
||||||
|
|
||||||
|
MVRespawnEvent respawnEvent = new MVRespawnEvent(respawnLocation, event.getPlayer(), "compatability");
|
||||||
|
this.plugin.getServer().getPluginManager().callEvent(respawnEvent);
|
||||||
|
event.setRespawnLocation(respawnEvent.getPlayersRespawnLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
if (this.plugin.getMVWorlds().size() == 0 && this.plugin.ph.hasPermission(event.getPlayer(), "multiverse.world.import", true)) {
|
if (this.plugin.getMVWorlds().size() == 0 && this.plugin.ph.hasPermission(event.getPlayer(), "multiverse.world.import", true)) {
|
||||||
@ -115,9 +117,9 @@ public class MVPlayerListener extends PlayerListener {
|
|||||||
event.getPlayer().sendMessage("If you just wanna see all of the Multiverse Help, type: " + ChatColor.GREEN + "/mv");
|
event.getPlayer().sendMessage("If you just wanna see all of the Multiverse Help, type: " + ChatColor.GREEN + "/mv");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,24 +3,32 @@ package com.onarandombox.MultiverseCore;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.config.Configuration;
|
import org.bukkit.util.config.Configuration;
|
||||||
|
|
||||||
|
import com.onarandombox.utils.BlockSafety;
|
||||||
|
|
||||||
public class MVPlayerSession {
|
public class MVPlayerSession {
|
||||||
|
|
||||||
private Player player; // Player holder, may be unnecessary.
|
private Player player; // Player holder, may be unnecessary.
|
||||||
public Location loc = new Location(null, 0, 0, 0); // Contain the Players Location so on player move we can compare this and check if they've moved a block.
|
protected Location loc = new Location(null, 0, 0, 0); // Contain the Players Location so on player move we can compare this and check if they've moved a block.
|
||||||
|
private BlockSafety bs = new BlockSafety();
|
||||||
public String portal = null; // Allow a player to target a portal to prevent them typing its name every command.
|
// Move to portals plugin
|
||||||
|
protected String portal = null; // Allow a player to target a portal to prevent them typing its name every command.
|
||||||
|
// Move to portals plugin
|
||||||
public Location coord1 = null; // Coordinate 1 (Left Click)
|
public Location coord1 = null; // Coordinate 1 (Left Click)
|
||||||
public Location coord2 = null; // Coordinate 2 (Right Click)
|
public Location coord2 = null; // Coordinate 2 (Right Click)
|
||||||
|
|
||||||
private Long teleportLast = 0L; // Timestamp for the Players last Portal Teleportation.
|
private Long teleportLast = 0L; // Timestamp for the Players last Portal Teleportation.
|
||||||
private Long messageLast = 0L; // Timestamp for the Players last Alert Message.
|
private Long messageLast = 0L; // Timestamp for the Players last Alert Message.
|
||||||
|
|
||||||
private World currentSpawn;
|
private Location bedSpawn;
|
||||||
|
|
||||||
|
// Beds are 2 blocks, thus we need to store both places
|
||||||
|
private Location bedA;
|
||||||
|
private Location bedB;
|
||||||
|
|
||||||
private Configuration config; // Configuration file to find out Cooldown Timers.
|
private Configuration config; // Configuration file to find out Cooldown Timers.
|
||||||
|
|
||||||
@ -28,7 +36,7 @@ public class MVPlayerSession {
|
|||||||
this.player = player;
|
this.player = player;
|
||||||
this.loc = player.getLocation();
|
this.loc = player.getLocation();
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.currentSpawn = player.getWorld();
|
this.bedSpawn = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,6 +48,7 @@ public class MVPlayerSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Grab whether the cooldown on Portal use has expired or not.
|
* Grab whether the cooldown on Portal use has expired or not.
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean getTeleportable() {
|
public boolean getTeleportable() {
|
||||||
@ -53,6 +62,7 @@ public class MVPlayerSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a Message to the Player as long as enough time has passed since the last message.
|
* Send a Message to the Player as long as enough time has passed since the last message.
|
||||||
|
*
|
||||||
* @param msg
|
* @param msg
|
||||||
*/
|
*/
|
||||||
public void message(String msg) {
|
public void message(String msg) {
|
||||||
@ -63,11 +73,42 @@ public class MVPlayerSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRespawnWorld(World world) {
|
public void setRespawnLocation(Location location) {
|
||||||
this.currentSpawn = world;
|
this.bedSpawn = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getRespawnWorld() {
|
//
|
||||||
return this.currentSpawn;
|
// public Location getRespawnLocation() {
|
||||||
|
// if (this.bedSpawn != null && !this.bs.playerCanSpawnHereSafely(this.bedSpawn)) {
|
||||||
|
// this.bedSpawn = null;
|
||||||
|
// }
|
||||||
|
// return this.bedSpawn;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// This one simply spawns the player closer to the bed.
|
||||||
|
public Location getBedRespawnLocation() {
|
||||||
|
// There is a bedrespawn set
|
||||||
|
if (this.bedSpawn != null) {
|
||||||
|
if (!this.bs.playerCanSpawnHereSafely(this.bedSpawn) || !bedStillExists(this.bedSpawn)) {
|
||||||
|
this.bedSpawn = null;
|
||||||
|
return this.bedSpawn;
|
||||||
|
}
|
||||||
|
Location actualRespawn = this.bedSpawn;
|
||||||
|
Location bedRespawn = new Location(actualRespawn.getWorld(), actualRespawn.getX(), actualRespawn.getY(), actualRespawn.getZ());
|
||||||
|
bedRespawn.setY(bedRespawn.getY() - .25);
|
||||||
|
return bedRespawn;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean bedStillExists(Location bedSpawn) {
|
||||||
|
//System.out.print("Dangers:");
|
||||||
|
//this.bs.showDangers(bedSpawn);
|
||||||
|
Location locationDown = new Location(bedSpawn.getWorld(), bedSpawn.getX(), bedSpawn.getY(), bedSpawn.getZ());
|
||||||
|
locationDown.setY(locationDown.getY() - 1);
|
||||||
|
if (locationDown.getBlock().getType() != Material.BED_BLOCK) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,15 +9,16 @@ import org.bukkit.event.server.ServerListener;
|
|||||||
|
|
||||||
import com.fernferret.allpay.AllPay;
|
import com.fernferret.allpay.AllPay;
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
|
import com.onarandombox.MultiverseCore.configuration.DefaultConfiguration;
|
||||||
|
|
||||||
public class MVPluginListener extends ServerListener {
|
public class MVPluginListener extends ServerListener {
|
||||||
|
|
||||||
MultiverseCore plugin;
|
MultiverseCore plugin;
|
||||||
|
|
||||||
public MVPluginListener(MultiverseCore plugin) {
|
public MVPluginListener(MultiverseCore plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keep an eye out for Plugins which we can utilize.
|
* Keep an eye out for Plugins which we can utilize.
|
||||||
*/
|
*/
|
||||||
@ -34,8 +35,13 @@ public class MVPluginListener extends ServerListener {
|
|||||||
if (Arrays.asList(AllPay.validEconPlugins).contains(event.getPlugin().getDescription().getName())) {
|
if (Arrays.asList(AllPay.validEconPlugins).contains(event.getPlugin().getDescription().getName())) {
|
||||||
this.plugin.bank = this.plugin.banker.loadEconPlugin();
|
this.plugin.bank = this.plugin.banker.loadEconPlugin();
|
||||||
}
|
}
|
||||||
|
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("MultiVerse")) {
|
||||||
|
this.plugin.getServer().getPluginManager().disablePlugin(event.getPlugin());
|
||||||
|
this.plugin.log(Level.WARNING, "I just disabled the old version of Multiverse for you. You should remove the JAR now, your configs have been migrated.");
|
||||||
|
new DefaultConfiguration(this.plugin.getDataFolder(), "config.yml", this.plugin.migrator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We'll check if any of the plugins we rely on decide to Disable themselves.
|
* We'll check if any of the plugins we rely on decide to Disable themselves.
|
||||||
*/
|
*/
|
||||||
@ -50,5 +56,5 @@ public class MVPluginListener extends ServerListener {
|
|||||||
}
|
}
|
||||||
// TODO: Disable econ when it disables.
|
// TODO: Disable econ when it disables.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,19 +12,19 @@ import org.bukkit.entity.Player;
|
|||||||
import com.onarandombox.utils.BlockSafety;
|
import com.onarandombox.utils.BlockSafety;
|
||||||
|
|
||||||
public class MVTeleport {
|
public class MVTeleport {
|
||||||
|
|
||||||
MultiverseCore plugin;
|
MultiverseCore plugin;
|
||||||
|
|
||||||
BlockSafety bs = new BlockSafety();
|
BlockSafety bs = new BlockSafety();
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
public MVTeleport(MultiverseCore plugin) {
|
public MVTeleport(MultiverseCore plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Sort out JavaDoc
|
* TODO: Sort out JavaDoc
|
||||||
*
|
*
|
||||||
* @param l
|
* @param l
|
||||||
* @param w
|
* @param w
|
||||||
* @return
|
* @return
|
||||||
@ -35,15 +35,15 @@ public class MVTeleport {
|
|||||||
if (l.getWorld().getName().equalsIgnoreCase(w.getName())) {
|
if (l.getWorld().getName().equalsIgnoreCase(w.getName())) {
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
double x, y, z;
|
double x, y, z;
|
||||||
|
|
||||||
// Grab the Scaling value for each world.
|
// Grab the Scaling value for each world.
|
||||||
double srcComp = this.plugin.getMVWorld(l.getWorld().getName()).getScaling();
|
double srcComp = this.plugin.getMVWorld(l.getWorld().getName()).getScaling();
|
||||||
double trgComp = this.plugin.getMVWorld(w.getName()).getScaling();
|
double trgComp = this.plugin.getMVWorld(w.getName()).getScaling();
|
||||||
|
|
||||||
// MultiverseCore.debugMsg(p.getName() + " -> " + p.getWorld().getName() + "(" + srcComp + ") -> " + w.getName() + "(" + trgComp + ")");
|
// MultiverseCore.debugMsg(p.getName() + " -> " + p.getWorld().getName() + "(" + srcComp + ") -> " + w.getName() + "(" + trgComp + ")");
|
||||||
|
|
||||||
// If the Targets Compression is 0 then we teleport them to the Spawn of the World.
|
// If the Targets Compression is 0 then we teleport them to the Spawn of the World.
|
||||||
if (trgComp == 0.0) {
|
if (trgComp == 0.0) {
|
||||||
x = w.getSpawnLocation().getX();
|
x = w.getSpawnLocation().getX();
|
||||||
@ -56,10 +56,29 @@ public class MVTeleport {
|
|||||||
}
|
}
|
||||||
return new Location(w, x, y, z);
|
return new Location(w, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be specific to beds, and check on top of the bed then around it.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Location getSafeBedDestination(Location bedLocation) {
|
||||||
|
System.out.print(bedLocation);
|
||||||
|
Location idealLocation = bedLocation;
|
||||||
|
idealLocation.setY(idealLocation.getY() + 1);
|
||||||
|
idealLocation.setX(idealLocation.getX() + .5);
|
||||||
|
idealLocation.setZ(idealLocation.getZ() + .5);
|
||||||
|
System.out.print(idealLocation);
|
||||||
|
if (this.bs.playerCanSpawnHereSafely(idealLocation)) {
|
||||||
|
System.out.print(idealLocation);
|
||||||
|
return bedLocation;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function gets a safe place to teleport to.
|
* This function gets a safe place to teleport to.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param player
|
* @param player
|
||||||
* @return
|
* @return
|
||||||
@ -69,12 +88,12 @@ public class MVTeleport {
|
|||||||
double y = l.getY();
|
double y = l.getY();
|
||||||
double z = l.getZ();
|
double z = l.getZ();
|
||||||
World w = l.getWorld();
|
World w = l.getWorld();
|
||||||
|
|
||||||
// To make things easier we'll start with the Y Coordinate on top of a Solid Block.
|
// To make things easier we'll start with the Y Coordinate on top of a Solid Block.
|
||||||
// while (bs.blockIsAboveAir(w, x, y, z)) {
|
// while (bs.blockIsAboveAir(w, x, y, z)) {
|
||||||
// y--;
|
// y--;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
double i = 0, r = 0, aux = -1;
|
double i = 0, r = 0, aux = -1;
|
||||||
for (r = 0; r < 32; r++) {
|
for (r = 0; r < 32; r++) {
|
||||||
for (i = x - r; i <= x + r; i++) {
|
for (i = x - r; i <= x + r; i++) {
|
||||||
@ -106,20 +125,20 @@ public class MVTeleport {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aux == -1) {
|
if (aux == -1) {
|
||||||
log.warning("Uh oh, no safe location.");
|
log.warning("Uh oh, no safe location.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//log.info("Target location (safe): " + x + ", " + aux + ", " + z);
|
// log.info("Target location (safe): " + x + ", " + aux + ", " + z);
|
||||||
|
|
||||||
return new Location(w, x, aux, z);
|
return new Location(w, x, aux, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the Column given to see if there is an available safe spot.
|
* Check the Column given to see if there is an available safe spot.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@ -137,10 +156,10 @@ public class MVTeleport {
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a portal around the given location and return a new location.
|
* Find a portal around the given location and return a new location.
|
||||||
*
|
*
|
||||||
* @param location
|
* @param location
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -156,7 +175,7 @@ public class MVTeleport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For each column try to find a portal block
|
// For each column try to find a portal block
|
||||||
for (Block col : columns) {
|
for (Block col : columns) {
|
||||||
for (int y = 0; y <= 127; y++) {
|
for (int y = 0; y <= 127; y++) {
|
||||||
|
@ -11,38 +11,38 @@ import org.bukkit.World.Environment;
|
|||||||
import org.bukkit.util.config.Configuration;
|
import org.bukkit.util.config.Configuration;
|
||||||
|
|
||||||
enum EnglishChatColor {
|
enum EnglishChatColor {
|
||||||
AQUA("AQUA", ChatColor.AQUA),
|
AQUA("AQUA", ChatColor.AQUA),
|
||||||
BLACK("BLACK", ChatColor.BLACK),
|
BLACK("BLACK", ChatColor.BLACK),
|
||||||
BLUE("BLUE", ChatColor.BLUE),
|
BLUE("BLUE", ChatColor.BLUE),
|
||||||
DARKAQUA("DARKAQUA", ChatColor.DARK_AQUA),
|
DARKAQUA("DARKAQUA", ChatColor.DARK_AQUA),
|
||||||
DARKBLUE("DARKBLUE", ChatColor.DARK_BLUE),
|
DARKBLUE("DARKBLUE", ChatColor.DARK_BLUE),
|
||||||
DARKGRAY("DARKGRAY", ChatColor.DARK_GRAY),
|
DARKGRAY("DARKGRAY", ChatColor.DARK_GRAY),
|
||||||
DARKGREEN("DARKGREEN", ChatColor.DARK_GREEN),
|
DARKGREEN("DARKGREEN", ChatColor.DARK_GREEN),
|
||||||
DARKPURPLE("DARKPURPLE", ChatColor.DARK_PURPLE),
|
DARKPURPLE("DARKPURPLE", ChatColor.DARK_PURPLE),
|
||||||
DARKRED("DARKRED", ChatColor.DARK_RED),
|
DARKRED("DARKRED", ChatColor.DARK_RED),
|
||||||
GOLD("GOLD", ChatColor.GOLD),
|
GOLD("GOLD", ChatColor.GOLD),
|
||||||
GRAY("GRAY", ChatColor.GRAY),
|
GRAY("GRAY", ChatColor.GRAY),
|
||||||
GREEN("GREEN", ChatColor.GREEN),
|
GREEN("GREEN", ChatColor.GREEN),
|
||||||
LIGHTPURPLE("LIGHTPURPLE", ChatColor.LIGHT_PURPLE),
|
LIGHTPURPLE("LIGHTPURPLE", ChatColor.LIGHT_PURPLE),
|
||||||
RED("RED", ChatColor.RED),
|
RED("RED", ChatColor.RED),
|
||||||
YELLOW("YELLOW", ChatColor.YELLOW),
|
YELLOW("YELLOW", ChatColor.YELLOW),
|
||||||
WHITE("WHITE", ChatColor.WHITE);
|
WHITE("WHITE", ChatColor.WHITE);
|
||||||
private ChatColor color;
|
private ChatColor color;
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
EnglishChatColor(String name, ChatColor color) {
|
EnglishChatColor(String name, ChatColor color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.text = name;
|
this.text = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getText() {
|
public String getText() {
|
||||||
return this.text;
|
return this.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatColor getColor() {
|
public ChatColor getColor() {
|
||||||
return this.color;
|
return this.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnglishChatColor fromString(String text) {
|
public static EnglishChatColor fromString(String text) {
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
for (EnglishChatColor c : EnglishChatColor.values()) {
|
for (EnglishChatColor c : EnglishChatColor.values()) {
|
||||||
@ -56,57 +56,53 @@ enum EnglishChatColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class MVWorld {
|
public class MVWorld {
|
||||||
|
|
||||||
private MultiverseCore plugin; // Hold the Plugin Instance.
|
private MultiverseCore plugin; // Hold the Plugin Instance.
|
||||||
private Configuration config; // Hold the Configuration File.
|
private Configuration config; // Hold the Configuration File.
|
||||||
|
|
||||||
private World world; // The World Instance.
|
private World world; // The World Instance.
|
||||||
private Environment environment; // Hold the Environment type EG Environment.NETHER / Environment.NORMAL
|
private Environment environment; // Hold the Environment type EG Environment.NETHER / Environment.NORMAL
|
||||||
private Long seed;
|
private Long seed;
|
||||||
|
|
||||||
private String name; // The Worlds Name, EG its folder name.
|
private String name; // The Worlds Name, EG its folder name.
|
||||||
private String alias = ""; // Short Alias for the World, this will be used in Chat Prefixes.
|
private String alias = ""; // Short Alias for the World, this will be used in Chat Prefixes.
|
||||||
private ChatColor aliasColor; // Color for this world
|
private ChatColor aliasColor; // Color for this world
|
||||||
|
|
||||||
private boolean allowAnimals; // Does this World allow Animals to Spawn?
|
private boolean allowAnimals; // Does this World allow Animals to Spawn?
|
||||||
// public List<String> animals = new ArrayList<String>(); // Contain a list of Animals which we want to ignore the Spawn Setting.
|
// public List<String> animals = new ArrayList<String>(); // Contain a list of Animals which we want to ignore the Spawn Setting.
|
||||||
|
|
||||||
private boolean allowMonsters; // Does this World allow Monsters to Spawn?
|
private boolean allowMonsters; // Does this World allow Monsters to Spawn?
|
||||||
// public List<String> monsters = new ArrayList<String>(); // Contain a list of Monsters which we want to ignore the Spawn Setting.
|
// public List<String> monsters = new ArrayList<String>(); // Contain a list of Monsters which we want to ignore the Spawn Setting.
|
||||||
|
|
||||||
private Boolean pvp; // Does this World allow PVP?
|
private Boolean pvp; // Does this World allow PVP?
|
||||||
|
private Boolean fakepvp;
|
||||||
|
|
||||||
|
private String respawnWorld; // Contains the name of the World to respawn the player to
|
||||||
|
|
||||||
private List<Integer> blockBlacklist; // Contain a list of Blocks which we won't allow on this World.
|
private List<Integer> blockBlacklist; // Contain a list of Blocks which we won't allow on this World.
|
||||||
|
|
||||||
// These have been moved to a hash, for easy editing with strings.
|
|
||||||
// private List<String> playerWhitelist; // Contain a list of Players/Groups which can join this World.
|
|
||||||
// private List<String> playerBlacklist; // Contain a list of Players/Groups which cannot join this World.
|
|
||||||
// private List<String> editWhitelist; // Contain a list of Players/Groups which can edit this World. (Place/Destroy Blocks)
|
|
||||||
// private List<String> editBlacklist; // Contain a list of Players/Groups which cannot edit this World. (Place/Destroy Blocks)
|
|
||||||
// private List<String> worldBlacklist; // Contain a list of Worlds which Players cannot use to Portal to this World.
|
|
||||||
|
|
||||||
private HashMap<String, List<String>> masterList;
|
private HashMap<String, List<String>> masterList;
|
||||||
|
|
||||||
private Double scaling; // How stretched/compressed distances are
|
private Double scaling; // How stretched/compressed distances are
|
||||||
/**
|
/**
|
||||||
* The generator as a string. This is used only for reporting. ex: BukkitFullOfMoon:GenID
|
* The generator as a string. This is used only for reporting. ex: BukkitFullOfMoon:GenID
|
||||||
*/
|
*/
|
||||||
private String generator;
|
private String generator;
|
||||||
|
|
||||||
public MVWorld(World world, Configuration config, MultiverseCore instance, Long seed, String generatorString) {
|
public MVWorld(World world, Configuration config, MultiverseCore instance, Long seed, String generatorString) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.plugin = instance;
|
this.plugin = instance;
|
||||||
|
|
||||||
// Set local values that CANNOT be changed by user
|
// Set local values that CANNOT be changed by user
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.name = world.getName();
|
this.name = world.getName();
|
||||||
this.generator = generatorString;
|
this.generator = generatorString;
|
||||||
this.seed = seed;
|
this.seed = seed;
|
||||||
this.environment = world.getEnvironment();
|
this.environment = world.getEnvironment();
|
||||||
|
|
||||||
// Initialize our lists
|
// Initialize our lists
|
||||||
this.initLists();
|
this.initLists();
|
||||||
|
|
||||||
// Write these files to the config (once it's saved)
|
// Write these files to the config (once it's saved)
|
||||||
if (generatorString != null) {
|
if (generatorString != null) {
|
||||||
config.setProperty("worlds." + this.name + ".generator", this.generator);
|
config.setProperty("worlds." + this.name + ".generator", this.generator);
|
||||||
@ -115,44 +111,73 @@ public class MVWorld {
|
|||||||
config.setProperty("worlds." + this.name + ".seed", this.seed);
|
config.setProperty("worlds." + this.name + ".seed", this.seed);
|
||||||
}
|
}
|
||||||
config.setProperty("worlds." + this.name + ".environment", this.environment.toString());
|
config.setProperty("worlds." + this.name + ".environment", this.environment.toString());
|
||||||
|
|
||||||
// Set local values that CAN be changed by the user
|
// Set local values that CAN be changed by the user
|
||||||
this.setAlias(config.getString("worlds." + this.name + ".alias.name", ""));
|
this.setAlias(config.getString("worlds." + this.name + ".alias.name", ""));
|
||||||
this.setAliasColor(config.getString("worlds." + this.name + ".alias.color", ChatColor.WHITE.toString()));
|
this.setAliasColor(config.getString("worlds." + this.name + ".alias.color", ChatColor.WHITE.toString()));
|
||||||
this.setPvp(config.getBoolean("worlds." + this.name + ".pvp", true));
|
this.setPvp(config.getBoolean("worlds." + this.name + ".pvp", true));
|
||||||
this.setScaling(config.getDouble("worlds." + this.name + ".scale", 1.0));
|
this.setScaling(config.getDouble("worlds." + this.name + ".scale", 1.0));
|
||||||
|
this.setRespawnToWorld(config.getString("worlds." + this.name + ".respawnworld", ""));
|
||||||
|
|
||||||
this.setAnimals(config.getBoolean("worlds." + this.name + ".animals.spawn", true));
|
this.setAnimals(config.getBoolean("worlds." + this.name + ".animals.spawn", true));
|
||||||
this.setMonsters(config.getBoolean("worlds." + this.name + ".monsters.spawn", true));
|
this.setMonsters(config.getBoolean("worlds." + this.name + ".monsters.spawn", true));
|
||||||
this.getMobExceptions();
|
this.getMobExceptions();
|
||||||
|
|
||||||
this.getPlayerWhitelist().addAll(config.getStringList("worlds." + this.name + ".playerwhitelist", new ArrayList<String>()));
|
this.getPlayerWhitelist().addAll(config.getStringList("worlds." + this.name + ".playerwhitelist", new ArrayList<String>()));
|
||||||
this.getPlayerBlacklist().addAll(config.getStringList("worlds." + this.name + ".playerblacklist", new ArrayList<String>()));
|
this.getPlayerBlacklist().addAll(config.getStringList("worlds." + this.name + ".playerblacklist", new ArrayList<String>()));
|
||||||
this.getWorldBlacklist().addAll(config.getStringList("worlds." + this.name + ".worldblacklist", new ArrayList<String>()));
|
this.getWorldBlacklist().addAll(config.getStringList("worlds." + this.name + ".worldblacklist", new ArrayList<String>()));
|
||||||
this.getBlockBlacklist().addAll(config.getIntList("worlds." + this.name + ".blockblacklist", new ArrayList<Integer>()));
|
this.getBlockBlacklist().addAll(config.getIntList("worlds." + this.name + ".blockblacklist", new ArrayList<Integer>()));
|
||||||
this.getEditWhitelist().addAll(config.getStringList("worlds." + this.name + ".editwhitelist", new ArrayList<String>()));
|
this.translateTempSpawn(config);
|
||||||
this.getEditBlacklist().addAll(config.getStringList("worlds." + this.name + ".editblacklist", new ArrayList<String>()));
|
|
||||||
|
|
||||||
config.save();
|
config.save();
|
||||||
// The following 3 lines will add some sample data to new worlds created.
|
// The following 3 lines will add some sample data to new worlds created.
|
||||||
// if (config.getIntList("worlds." + name + ".blockBlacklist", new ArrayList<Integer>()).size() == 0) {
|
// if (config.getIntList("worlds." + name + ".blockBlacklist", new ArrayList<Integer>()).size() == 0) {
|
||||||
// addSampleData();
|
// addSampleData();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getColoredWorldString() {
|
private void translateTempSpawn(Configuration config) {
|
||||||
if (this.getAlias() != null && this.getAlias().length() > 0) {
|
String tempspawn = config.getString("worlds." + this.name + ".tempspawn", "");
|
||||||
return this.getAliasColor() + this.getAlias() + ChatColor.WHITE;
|
if (tempspawn.length() > 0) {
|
||||||
} else {
|
String[] coordsString = tempspawn.split(":");
|
||||||
return this.world.getName();
|
if (coordsString.length >= 3) {
|
||||||
|
int[] coords = new int[3];
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
|
||||||
|
coords[i] = Integer.parseInt(coordsString[i]);
|
||||||
|
}
|
||||||
|
this.world.setSpawnLocation(coords[0], coords[1], coords[2]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
this.plugin.log(Level.WARNING, "A MV1 spawn value was found, but it could not be migrated. Format Error. Sorry.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.plugin.log(Level.WARNING, "A MV1 spawn value was found, but it could not be migrated. Format Error. Sorry.");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config.removeProperty("worlds." + this.name + ".tempspawn");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getColoredWorldString() {
|
||||||
|
ChatColor color = this.getAliasColor();
|
||||||
|
if (color == null) {
|
||||||
|
if (this.environment == Environment.NETHER) {
|
||||||
|
color = ChatColor.RED;
|
||||||
|
} else if (this.environment == Environment.NORMAL) {
|
||||||
|
color = ChatColor.GREEN;
|
||||||
|
} else if (this.environment == Environment.SKYLANDS) {
|
||||||
|
color = ChatColor.AQUA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.getAliasColor() + this.getAlias() + ChatColor.WHITE;
|
||||||
|
}
|
||||||
|
|
||||||
private void getMobExceptions() {
|
private void getMobExceptions() {
|
||||||
List<String> temp;
|
List<String> temp;
|
||||||
temp = this.config.getStringList("worlds." + this.name + ".animals.exceptions", new ArrayList<String>());
|
temp = this.config.getStringList("worlds." + this.name + ".animals.exceptions", new ArrayList<String>());
|
||||||
// Add Animals to the exclusion list
|
// Add Animals to the exclusion list
|
||||||
|
|
||||||
for (String s : temp) {
|
for (String s : temp) {
|
||||||
this.masterList.get("animals").add(s.toUpperCase());
|
this.masterList.get("animals").add(s.toUpperCase());
|
||||||
}
|
}
|
||||||
@ -162,57 +187,47 @@ public class MVWorld {
|
|||||||
this.masterList.get("monsters").add(s.toUpperCase());
|
this.masterList.get("monsters").add(s.toUpperCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getCBWorld() {
|
public World getCBWorld() {
|
||||||
return this.world;
|
return this.world;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initLists() {
|
private void initLists() {
|
||||||
this.masterList = new HashMap<String, List<String>>();
|
this.masterList = new HashMap<String, List<String>>();
|
||||||
this.blockBlacklist = new ArrayList<Integer>();
|
this.blockBlacklist = new ArrayList<Integer>();
|
||||||
// Only int list, we don't need to add it to the masterlist
|
// Only int list, we don't need to add it to the masterlist
|
||||||
this.masterList.put("playerwhitelist", new ArrayList<String>());
|
this.masterList.put("playerwhitelist", new ArrayList<String>());
|
||||||
this.masterList.put("playerblacklist", new ArrayList<String>());
|
this.masterList.put("playerblacklist", new ArrayList<String>());
|
||||||
this.masterList.put("editwhitelist", new ArrayList<String>());
|
|
||||||
this.masterList.put("editblacklist", new ArrayList<String>());
|
|
||||||
this.masterList.put("worldblacklist", new ArrayList<String>());
|
this.masterList.put("worldblacklist", new ArrayList<String>());
|
||||||
this.masterList.put("animals", new ArrayList<String>());
|
this.masterList.put("animals", new ArrayList<String>());
|
||||||
this.masterList.put("monsters", new ArrayList<String>());
|
this.masterList.put("monsters", new ArrayList<String>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSampleData() {
|
public void addSampleData() {
|
||||||
this.getMonsterList().add("creeper");
|
this.getMonsterList().add("creeper");
|
||||||
|
|
||||||
this.getAnimalList().add("pig");
|
this.getAnimalList().add("pig");
|
||||||
|
|
||||||
this.blockBlacklist.add(49);
|
this.blockBlacklist.add(49);
|
||||||
|
|
||||||
this.getPlayerWhitelist().add("fernferret");
|
this.getPlayerWhitelist().add("fernferret");
|
||||||
this.getPlayerBlacklist().add("g:Admins");
|
this.getPlayerBlacklist().add("g:Admins");
|
||||||
|
|
||||||
this.getPlayerBlacklist().add("Rigby90");
|
this.getPlayerBlacklist().add("Rigby90");
|
||||||
this.getPlayerBlacklist().add("g:Banned");
|
this.getPlayerBlacklist().add("g:Banned");
|
||||||
|
|
||||||
this.getEditWhitelist().add("fernferret");
|
|
||||||
this.getEditWhitelist().add("g:Admins");
|
|
||||||
|
|
||||||
this.getEditBlacklist().add("Rigby90");
|
|
||||||
this.getEditBlacklist().add("g:Banned");
|
|
||||||
|
|
||||||
this.getWorldBlacklist().add("world5");
|
this.getWorldBlacklist().add("world5");
|
||||||
this.getWorldBlacklist().add("A world with spaces");
|
this.getWorldBlacklist().add("A world with spaces");
|
||||||
|
|
||||||
this.config.setProperty("worlds." + this.name + ".animals.exceptions", this.getAnimalList());
|
this.config.setProperty("worlds." + this.name + ".animals.exceptions", this.getAnimalList());
|
||||||
this.config.setProperty("worlds." + this.name + ".monsters.exceptions", this.getMonsterList());
|
this.config.setProperty("worlds." + this.name + ".monsters.exceptions", this.getMonsterList());
|
||||||
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.getBlockBlacklist());
|
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.getBlockBlacklist());
|
||||||
this.config.setProperty("worlds." + this.name + ".playerwhitelist", this.getPlayerWhitelist());
|
this.config.setProperty("worlds." + this.name + ".playerwhitelist", this.getPlayerWhitelist());
|
||||||
this.config.setProperty("worlds." + this.name + ".playerblacklist", this.getPlayerBlacklist());
|
this.config.setProperty("worlds." + this.name + ".playerblacklist", this.getPlayerBlacklist());
|
||||||
this.config.setProperty("worlds." + this.name + ".editwhitelist", this.getEditWhitelist());
|
|
||||||
this.config.setProperty("worlds." + this.name + ".editblacklist", this.getEditBlacklist());
|
|
||||||
this.config.setProperty("worlds." + this.name + ".worldblacklist", this.getWorldBlacklist());
|
this.config.setProperty("worlds." + this.name + ".worldblacklist", this.getWorldBlacklist());
|
||||||
this.config.save();
|
this.config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean clearVariable(String property) {
|
public boolean clearVariable(String property) {
|
||||||
if (property.equalsIgnoreCase("blockblacklist")) {
|
if (property.equalsIgnoreCase("blockblacklist")) {
|
||||||
this.blockBlacklist.clear();
|
this.blockBlacklist.clear();
|
||||||
@ -225,7 +240,7 @@ public class MVWorld {
|
|||||||
this.config.save();
|
this.config.save();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addToList(String list, String value) {
|
public boolean addToList(String list, String value) {
|
||||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||||
try {
|
try {
|
||||||
@ -234,7 +249,7 @@ public class MVWorld {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
} else if (this.masterList.keySet().contains(list)) {
|
} else if (this.masterList.keySet().contains(list)) {
|
||||||
|
|
||||||
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
|
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
|
||||||
this.masterList.get(list).add(value.toUpperCase());
|
this.masterList.get(list).add(value.toUpperCase());
|
||||||
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
|
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
|
||||||
@ -248,7 +263,7 @@ public class MVWorld {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeFromList(String list, String value) {
|
public boolean removeFromList(String list, String value) {
|
||||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||||
try {
|
try {
|
||||||
@ -258,7 +273,7 @@ public class MVWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.masterList.keySet().contains(list)) {
|
if (this.masterList.keySet().contains(list)) {
|
||||||
|
|
||||||
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
|
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
|
||||||
this.masterList.get(list).remove(value.toUpperCase());
|
this.masterList.get(list).remove(value.toUpperCase());
|
||||||
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
|
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
|
||||||
@ -272,8 +287,9 @@ public class MVWorld {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncMobs() {
|
private void syncMobs() {
|
||||||
|
|
||||||
if (this.getAnimalList().isEmpty()) {
|
if (this.getAnimalList().isEmpty()) {
|
||||||
this.world.setSpawnFlags(this.world.getAllowMonsters(), this.allowAnimals);
|
this.world.setSpawnFlags(this.world.getAllowMonsters(), this.allowAnimals);
|
||||||
} else {
|
} else {
|
||||||
@ -286,7 +302,7 @@ public class MVWorld {
|
|||||||
}
|
}
|
||||||
this.plugin.getWorldPurger().purgeWorld(null, this);
|
this.plugin.getWorldPurger().purgeWorld(null, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean addToList(String list, Integer value) {
|
private boolean addToList(String list, Integer value) {
|
||||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||||
this.blockBlacklist.add(value);
|
this.blockBlacklist.add(value);
|
||||||
@ -294,9 +310,9 @@ public class MVWorld {
|
|||||||
this.config.save();
|
this.config.save();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean removeFromList(String list, Integer value) {
|
private boolean removeFromList(String list, Integer value) {
|
||||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||||
this.blockBlacklist.remove(value);
|
this.blockBlacklist.remove(value);
|
||||||
@ -304,14 +320,14 @@ public class MVWorld {
|
|||||||
this.config.save();
|
this.config.save();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setVariable(String name, boolean value) {
|
private boolean setVariable(String name, boolean value) {
|
||||||
if (name.equalsIgnoreCase("pvp")) {
|
if (name.equalsIgnoreCase("pvp")) {
|
||||||
this.setPvp(value);
|
this.setPvp(value);
|
||||||
} else if (name.equalsIgnoreCase("animals")) {
|
} else if (name.equalsIgnoreCase("animals")) {
|
||||||
|
|
||||||
this.setAnimals(value);
|
this.setAnimals(value);
|
||||||
} else if (name.equalsIgnoreCase("monsters")) {
|
} else if (name.equalsIgnoreCase("monsters")) {
|
||||||
this.setMonsters(value);
|
this.setMonsters(value);
|
||||||
@ -320,26 +336,34 @@ public class MVWorld {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setVariable(String name, double value) {
|
private boolean setVariable(String name, double value) {
|
||||||
if (name.equalsIgnoreCase("scaling")) {
|
if (name.equalsIgnoreCase("scaling")) {
|
||||||
this.setScaling(value);
|
this.setScaling(value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the one people have access to. It'll handle the rest.
|
* This is the one people have access to. It'll handle the rest.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean setVariable(String name, String value) {
|
public boolean setVariable(String name, String value) {
|
||||||
if (name.equalsIgnoreCase("alias")) {
|
if (name.equalsIgnoreCase("alias")) {
|
||||||
this.alias = value;
|
this.setAlias(value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (name.equalsIgnoreCase("respawn")) {
|
||||||
|
this.setRespawnToWorld(value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (name.equalsIgnoreCase("aliascolor") || name.equalsIgnoreCase("color")) {
|
||||||
|
this.setAliasColor(value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -347,51 +371,54 @@ public class MVWorld {
|
|||||||
return this.setVariable(name, boolValue);
|
return this.setVariable(name, boolValue);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
double doubValue = Double.parseDouble(value);
|
double doubValue = Double.parseDouble(value);
|
||||||
return this.setVariable(name, doubValue);
|
return this.setVariable(name, doubValue);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Environment getEnvironment() {
|
public Environment getEnvironment() {
|
||||||
return this.environment;
|
return this.environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnvironment(Environment environment) {
|
public void setEnvironment(Environment environment) {
|
||||||
this.environment = environment;
|
this.environment = environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getSeed() {
|
public Long getSeed() {
|
||||||
return this.seed;
|
return this.seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSeed(Long seed) {
|
public void setSeed(Long seed) {
|
||||||
this.seed = seed;
|
this.seed = seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlias() {
|
public String getAlias() {
|
||||||
|
if (this.alias == null || this.alias.length() == 0) {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
return this.alias;
|
return this.alias;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAlias(String alias) {
|
public void setAlias(String alias) {
|
||||||
this.alias = alias;
|
this.alias = alias;
|
||||||
this.config.setProperty("worlds." + this.name + ".alias.name", alias);
|
this.config.setProperty("worlds." + this.name + ".alias.name", alias);
|
||||||
this.config.save();
|
this.config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean allowAnimalSpawning() {
|
public Boolean allowAnimalSpawning() {
|
||||||
return this.allowAnimals;
|
return this.allowAnimals;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAnimals(Boolean animals) {
|
private void setAnimals(Boolean animals) {
|
||||||
this.allowAnimals = animals;
|
this.allowAnimals = animals;
|
||||||
// If animals are a boolean, then we can turn them on or off on the server
|
// If animals are a boolean, then we can turn them on or off on the server
|
||||||
@ -400,15 +427,15 @@ public class MVWorld {
|
|||||||
this.config.save();
|
this.config.save();
|
||||||
this.syncMobs();
|
this.syncMobs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getAnimalList() {
|
public List<String> getAnimalList() {
|
||||||
return this.masterList.get("animals");
|
return this.masterList.get("animals");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean allowMonsterSpawning() {
|
public Boolean allowMonsterSpawning() {
|
||||||
return this.allowMonsters;
|
return this.allowMonsters;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMonsters(Boolean monsters) {
|
private void setMonsters(Boolean monsters) {
|
||||||
this.allowMonsters = monsters;
|
this.allowMonsters = monsters;
|
||||||
// If monsters are a boolean, then we can turn them on or off on the server
|
// If monsters are a boolean, then we can turn them on or off on the server
|
||||||
@ -417,51 +444,48 @@ public class MVWorld {
|
|||||||
this.config.save();
|
this.config.save();
|
||||||
this.syncMobs();
|
this.syncMobs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getMonsterList() {
|
public List<String> getMonsterList() {
|
||||||
return this.masterList.get("monsters");
|
return this.masterList.get("monsters");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getPvp() {
|
public Boolean getPvp() {
|
||||||
return this.pvp;
|
return this.pvp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPvp(Boolean pvp) {
|
public void setPvp(Boolean pvp) {
|
||||||
this.world.setPVP(pvp);
|
this.fakepvp = this.plugin.configMV.getBoolean("fakepvp", false);
|
||||||
|
if (this.fakepvp) {
|
||||||
|
this.world.setPVP(true);
|
||||||
|
} else {
|
||||||
|
this.world.setPVP(pvp);
|
||||||
|
}
|
||||||
this.pvp = pvp;
|
this.pvp = pvp;
|
||||||
this.config.setProperty("worlds." + this.name + ".pvp", pvp);
|
this.config.setProperty("worlds." + this.name + ".pvp", pvp);
|
||||||
this.config.save();
|
this.config.save();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getBlockBlacklist() {
|
public List<Integer> getBlockBlacklist() {
|
||||||
return this.blockBlacklist;
|
return this.blockBlacklist;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getPlayerWhitelist() {
|
public List<String> getPlayerWhitelist() {
|
||||||
return this.masterList.get("playerwhitelist");
|
return this.masterList.get("playerwhitelist");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getPlayerBlacklist() {
|
public List<String> getPlayerBlacklist() {
|
||||||
return this.masterList.get("playerblacklist");
|
return this.masterList.get("playerblacklist");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getEditWhitelist() {
|
|
||||||
return this.masterList.get("editwhitelist");
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getEditBlacklist() {
|
|
||||||
return this.masterList.get("editblacklist");
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getWorldBlacklist() {
|
public List<String> getWorldBlacklist() {
|
||||||
return this.masterList.get("worldblacklist");
|
return this.masterList.get("worldblacklist");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getScaling() {
|
public Double getScaling() {
|
||||||
return this.scaling;
|
return this.scaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScaling(Double scaling) {
|
public void setScaling(Double scaling) {
|
||||||
if (scaling <= 0) {
|
if (scaling <= 0) {
|
||||||
// Disallow negative or 0 scalings.
|
// Disallow negative or 0 scalings.
|
||||||
@ -471,19 +495,31 @@ public class MVWorld {
|
|||||||
this.config.setProperty("worlds." + this.name + ".scaling", scaling);
|
this.config.setProperty("worlds." + this.name + ".scaling", scaling);
|
||||||
this.config.save();
|
this.config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the chat color from a string.
|
||||||
|
*
|
||||||
|
* @param aliasColor
|
||||||
|
*/
|
||||||
public void setAliasColor(String aliasColor) {
|
public void setAliasColor(String aliasColor) {
|
||||||
EnglishChatColor color = EnglishChatColor.fromString(aliasColor);
|
EnglishChatColor color = EnglishChatColor.fromString(aliasColor);
|
||||||
|
if (color == null) {
|
||||||
|
color = EnglishChatColor.WHITE;
|
||||||
|
}
|
||||||
this.aliasColor = color.getColor();
|
this.aliasColor = color.getColor();
|
||||||
this.config.setProperty("worlds." + this.name + ".alias.color", color.getText());
|
this.config.setProperty("worlds." + this.name + ".alias.color", color.getText());
|
||||||
this.config.save();
|
this.config.save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isValidAliasColor(String aliasColor) {
|
||||||
|
return (EnglishChatColor.fromString(aliasColor) != null);
|
||||||
|
}
|
||||||
|
|
||||||
public ChatColor getAliasColor() {
|
public ChatColor getAliasColor() {
|
||||||
return this.aliasColor;
|
return this.aliasColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean clearList(String property) {
|
public boolean clearList(String property) {
|
||||||
if (property.equalsIgnoreCase("blockblacklist")) {
|
if (property.equalsIgnoreCase("blockblacklist")) {
|
||||||
this.blockBlacklist.clear();
|
this.blockBlacklist.clear();
|
||||||
@ -498,4 +534,17 @@ public class MVWorld {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getFakePVP() {
|
||||||
|
return this.fakepvp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRespawnToWorld() {
|
||||||
|
return this.respawnWorld;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRespawnToWorld(String respawnToWorld) {
|
||||||
|
this.respawnWorld = respawnToWorld;
|
||||||
|
this.config.setProperty("worlds."+this.name+".respawnworld", respawnToWorld);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.onarandombox.MultiverseCore;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -23,12 +24,12 @@ import org.bukkit.util.config.Configuration;
|
|||||||
|
|
||||||
import com.fernferret.allpay.AllPay;
|
import com.fernferret.allpay.AllPay;
|
||||||
import com.fernferret.allpay.GenericBank;
|
import com.fernferret.allpay.GenericBank;
|
||||||
import com.onarandombox.MultiverseCore.command.CommandManager;
|
import com.onarandombox.MultiverseCore.commands.*;
|
||||||
import com.onarandombox.MultiverseCore.command.commands.*;
|
|
||||||
import com.onarandombox.MultiverseCore.configuration.DefaultConfiguration;
|
import com.onarandombox.MultiverseCore.configuration.DefaultConfiguration;
|
||||||
import com.onarandombox.utils.DebugLog;
|
import com.onarandombox.utils.DebugLog;
|
||||||
import com.onarandombox.utils.PurgeWorlds;
|
import com.onarandombox.utils.PurgeWorlds;
|
||||||
import com.onarandombox.utils.UpdateChecker;
|
import com.onarandombox.utils.UpdateChecker;
|
||||||
|
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||||
|
|
||||||
public class MultiverseCore extends JavaPlugin {
|
public class MultiverseCore extends JavaPlugin {
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
private boolean debug;
|
private boolean debug;
|
||||||
|
|
||||||
// Setup our Map for our Commands using the CommandHandler.
|
// Setup our Map for our Commands using the CommandHandler.
|
||||||
private CommandManager commandManager;
|
private CommandHandler commandHandler;
|
||||||
|
|
||||||
private final String tag = "[Multiverse-Core]";
|
private final String tag = "[Multiverse-Core]";
|
||||||
|
|
||||||
@ -64,10 +65,12 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
private HashMap<String, MVWorld> worlds = new HashMap<String, MVWorld>();
|
private HashMap<String, MVWorld> worlds = new HashMap<String, MVWorld>();
|
||||||
|
|
||||||
// HashMap to contain information relating to the Players.
|
// HashMap to contain information relating to the Players.
|
||||||
public HashMap<String, MVPlayerSession> playerSessions = new HashMap<String, MVPlayerSession>();
|
private HashMap<String, MVPlayerSession> playerSessions;
|
||||||
private PurgeWorlds worldPurger;
|
private PurgeWorlds worldPurger;
|
||||||
public GenericBank bank = null;
|
public GenericBank bank = null;
|
||||||
public AllPay banker = new AllPay(this, "[Multiverse-Core] ");;
|
public AllPay banker = new AllPay(this, "[Multiverse-Core] ");
|
||||||
|
public static boolean defaultConfigsCreated = false;
|
||||||
|
protected MVConfigMigrator migrator = new MVConfigMigrator(this);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
@ -83,27 +86,33 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Output a little snippet to show it's enabled.
|
// Output a little snippet to show it's enabled.
|
||||||
this.log(Level.INFO, "- Version " + this.getDescription().getVersion() + " Enabled - By " + getAuthors());
|
this.log(Level.INFO, "- Version " + this.getDescription().getVersion() + " Enabled - By " + getAuthors());
|
||||||
|
|
||||||
// Setup all the Events the plugin needs to Monitor.
|
// Setup all the Events the plugin needs to Monitor.
|
||||||
this.registerEvents();
|
this.registerEvents();
|
||||||
// Setup Permissions, we'll do an initial check for the Permissions plugin then fall back on isOP().
|
// Setup Permissions, we'll do an initial check for the Permissions plugin then fall back on isOP().
|
||||||
this.ph = new MVPermissions(this);
|
this.ph = new MVPermissions(this);
|
||||||
|
|
||||||
this.bank = this.banker.loadEconPlugin();
|
this.bank = this.banker.loadEconPlugin();
|
||||||
// Setup the command manager
|
// Setup the command manager
|
||||||
this.commandManager = new CommandManager(this);
|
this.commandHandler = new CommandHandler(this, this.ph);
|
||||||
// Setup the world purger
|
// Setup the world purger
|
||||||
this.worldPurger = new PurgeWorlds(this);
|
this.worldPurger = new PurgeWorlds(this);
|
||||||
// Call the Function to assign all the Commands to their Class.
|
// Call the Function to assign all the Commands to their Class.
|
||||||
this.registerCommands();
|
this.registerCommands();
|
||||||
|
|
||||||
|
this.playerSessions = new HashMap<String, MVPlayerSession>();
|
||||||
|
|
||||||
// Start the Update Checker
|
// Start the Update Checker
|
||||||
// updateCheck = new UpdateChecker(this.getDescription().getName(), this.getDescription().getVersion());
|
// updateCheck = new UpdateChecker(this.getDescription().getName(), this.getDescription().getVersion());
|
||||||
|
|
||||||
// Call the Function to load all the Worlds and setup the HashMap
|
// Call the Function to load all the Worlds and setup the HashMap
|
||||||
// When called with null, it tries to load ALL
|
// When called with null, it tries to load ALL
|
||||||
// this function will be called every time a plugin registers a new envtype with MV
|
// this function will be called every time a plugin registers a new envtype with MV
|
||||||
this.loadWorlds(true);
|
if (this.configMV != null) {
|
||||||
|
this.loadWorlds(true);
|
||||||
|
} else {
|
||||||
|
this.log(Level.WARNING, "Your configs were not loaded. Very little will function in MV.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,11 +125,12 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
pm.registerEvent(Event.Type.PLAYER_JOIN, this.playerListener, Priority.Normal, this); // To create the Player Session
|
pm.registerEvent(Event.Type.PLAYER_JOIN, this.playerListener, Priority.Normal, this); // To create the Player Session
|
||||||
pm.registerEvent(Event.Type.PLAYER_QUIT, this.playerListener, Priority.Normal, this); // To remove Player Sessions
|
pm.registerEvent(Event.Type.PLAYER_QUIT, this.playerListener, Priority.Normal, this); // To remove Player Sessions
|
||||||
pm.registerEvent(Event.Type.PLAYER_KICK, this.playerListener, Priority.Highest, this);
|
pm.registerEvent(Event.Type.PLAYER_KICK, this.playerListener, Priority.Highest, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_RESPAWN, this.playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_RESPAWN, this.playerListener, Priority.Low, this); // Let plugins which specialize in (re)spawning carry more weight.
|
||||||
pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Priority.Normal, this);
|
||||||
|
pm.registerEvent(Event.Type.PLAYER_BED_LEAVE, this.playerListener, Priority.Normal, this);
|
||||||
|
|
||||||
pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, this.entityListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, this.entityListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, this.entityListener, Priority.Normal, this); // To Allow/Disallow PVP as well as EnableHealth.
|
pm.registerEvent(Event.Type.ENTITY_DAMAGE, this.entityListener, Priority.Normal, this); // To Allow/Disallow fake PVP
|
||||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, this.entityListener, Priority.Normal, this); // To prevent all or certain animals/monsters from spawning.
|
pm.registerEvent(Event.Type.CREATURE_SPAWN, this.entityListener, Priority.Normal, this); // To prevent all or certain animals/monsters from spawning.
|
||||||
|
|
||||||
pm.registerEvent(Event.Type.PLUGIN_ENABLE, this.pluginListener, Priority.Monitor, this);
|
pm.registerEvent(Event.Type.PLUGIN_ENABLE, this.pluginListener, Priority.Monitor, this);
|
||||||
@ -136,9 +146,10 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
* Load the Configuration files OR create the default config files.
|
* Load the Configuration files OR create the default config files.
|
||||||
*/
|
*/
|
||||||
public void loadConfigs() {
|
public void loadConfigs() {
|
||||||
|
|
||||||
// Call the defaultConfiguration class to create the config files if they don't already exist.
|
// Call the defaultConfiguration class to create the config files if they don't already exist.
|
||||||
new DefaultConfiguration(getDataFolder(), "config.yml");
|
new DefaultConfiguration(getDataFolder(), "config.yml", this.migrator);
|
||||||
new DefaultConfiguration(getDataFolder(), "worlds.yml");
|
new DefaultConfiguration(getDataFolder(), "worlds.yml", this.migrator);
|
||||||
|
|
||||||
// Now grab the Configuration Files.
|
// Now grab the Configuration Files.
|
||||||
this.configMV = new Configuration(new File(getDataFolder(), "config.yml"));
|
this.configMV = new Configuration(new File(getDataFolder(), "config.yml"));
|
||||||
@ -164,34 +175,37 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register Multiverse-Core commands to DThielke's Command Manager.
|
* Register Multiverse-Core commands to Command Manager.
|
||||||
*/
|
*/
|
||||||
private void registerCommands() {
|
private void registerCommands() {
|
||||||
// Page 1
|
// Intro Commands
|
||||||
this.commandManager.addCommand(new HelpCommand(this));
|
this.commandHandler.registerCommand(new ListCommand(this));
|
||||||
this.commandManager.addCommand(new CoordCommand(this));
|
this.commandHandler.registerCommand(new InfoCommand(this));
|
||||||
this.commandManager.addCommand(new TeleportCommand(this));
|
this.commandHandler.registerCommand(new CreateCommand(this));
|
||||||
this.commandManager.addCommand(new ListCommand(this));
|
this.commandHandler.registerCommand(new ImportCommand(this));
|
||||||
this.commandManager.addCommand(new WhoCommand(this));
|
this.commandHandler.registerCommand(new ReloadCommand(this));
|
||||||
this.commandManager.addCommand(new SetSpawnCommand(this));
|
this.commandHandler.registerCommand(new SetSpawnCommand(this));
|
||||||
this.commandManager.addCommand(new CreateCommand(this));
|
this.commandHandler.registerCommand(new CoordCommand(this));
|
||||||
this.commandManager.addCommand(new ImportCommand(this));
|
this.commandHandler.registerCommand(new TeleportCommand(this));
|
||||||
this.commandManager.addCommand(new SpawnCommand(this));
|
this.commandHandler.registerCommand(new WhoCommand(this));
|
||||||
this.commandManager.addCommand(new RemoveCommand(this));
|
this.commandHandler.registerCommand(new SpawnCommand(this));
|
||||||
this.commandManager.addCommand(new DeleteCommand(this));
|
// Dangerous Commands
|
||||||
this.commandManager.addCommand(new UnloadCommand(this));
|
this.commandHandler.registerCommand(new UnloadCommand(this));
|
||||||
this.commandManager.addCommand(new ConfirmCommand(this));
|
this.commandHandler.registerCommand(new RemoveCommand(this));
|
||||||
this.commandManager.addCommand(new InfoCommand(this));
|
this.commandHandler.registerCommand(new DeleteCommand(this));
|
||||||
this.commandManager.addCommand(new ReloadCommand(this));
|
this.commandHandler.registerCommand(new ConfirmCommand(this));
|
||||||
|
// Modification commands
|
||||||
this.commandManager.addCommand(new ModifyAddCommand(this));
|
this.commandHandler.registerCommand(new PurgeCommand(this));
|
||||||
this.commandManager.addCommand(new ModifySetCommand(this));
|
this.commandHandler.registerCommand(new ModifyAddCommand(this));
|
||||||
this.commandManager.addCommand(new ModifyRemoveCommand(this));
|
this.commandHandler.registerCommand(new ModifySetCommand(this));
|
||||||
this.commandManager.addCommand(new ModifyClearCommand(this));
|
this.commandHandler.registerCommand(new ModifyRemoveCommand(this));
|
||||||
|
this.commandHandler.registerCommand(new ModifyClearCommand(this));
|
||||||
// This modify MUST go last.
|
// This modify MUST go last.
|
||||||
this.commandManager.addCommand(new ModifyCommand(this));
|
this.commandHandler.registerCommand(new ModifyCommand(this));
|
||||||
this.commandManager.addCommand(new EnvironmentCommand(this));
|
// Misc Commands
|
||||||
this.commandManager.addCommand(new PurgeCommand(this));
|
this.commandHandler.registerCommand(new EnvironmentCommand(this));
|
||||||
|
this.commandHandler.registerCommand(new SleepCommand(this));
|
||||||
|
this.commandHandler.registerCommand(new HelpCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -237,36 +251,13 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
log(Level.INFO, count + " - World(s) loaded.");
|
log(Level.INFO, count + " - World(s) loaded.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private int loadDefaultWorlds() {
|
|
||||||
int additonalWorldsLoaded = 0;
|
|
||||||
// Load the default world:
|
|
||||||
World world = this.getServer().getWorlds().get(0);
|
|
||||||
if (!this.worlds.containsKey(world.getName())) {
|
|
||||||
addWorld(world.getName(), Environment.NORMAL, null, null);
|
|
||||||
additonalWorldsLoaded++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This next one could be null if they have it disabled in server.props
|
|
||||||
World world_nether = this.getServer().getWorld(world.getName() + "_nether");
|
|
||||||
if (world_nether != null && !this.worlds.containsKey(world_nether.getName())) {
|
|
||||||
addWorld(world_nether.getName(), Environment.NETHER, null, null);
|
|
||||||
additonalWorldsLoaded++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return additonalWorldsLoaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new World to the Multiverse Setup.
|
* Add a new World to the Multiverse Setup.
|
||||||
*
|
* <p/>
|
||||||
* Isn't there a prettier way to do this??!!?!?!
|
* Isn't there a prettier way to do this??!!?!?!
|
||||||
*
|
*
|
||||||
* @param name World Name
|
* @param name World Name
|
||||||
* @param environment Environment Type
|
* @param env Environment Type
|
||||||
*/
|
*/
|
||||||
public boolean addWorld(String name, Environment env, String seedString, String generator) {
|
public boolean addWorld(String name, Environment env, String seedString, String generator) {
|
||||||
this.debugLog(Level.CONFIG, "Adding world with: " + name + ", " + env.toString() + ", " + seedString + ", " + generator);
|
this.debugLog(Level.CONFIG, "Adding world with: " + name + ", " + env.toString() + ", " + seedString + ", " + generator);
|
||||||
@ -319,11 +310,16 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env);
|
log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (world == null) {
|
||||||
|
log(Level.SEVERE, "Failed to Create/Load the world '" + name + "'");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
MVWorld mvworld = new MVWorld(world, this.configWorlds, this, seed, generator);
|
MVWorld mvworld = new MVWorld(world, this.configWorlds, this, seed, generator);
|
||||||
this.worldPurger.purgeWorld(null, mvworld);
|
this.worldPurger.purgeWorld(null, mvworld);
|
||||||
this.worlds.put(name, mvworld);
|
this.worlds.put(name, mvworld);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean pluginExists(String generator) {
|
private boolean pluginExists(String generator) {
|
||||||
@ -347,7 +343,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the world from the Multiverse list
|
* Remove the world from the Multiverse list
|
||||||
*
|
*
|
||||||
* @param name The name of the world to remove
|
* @param name The name of the world to remove
|
||||||
* @return True if success, false if failure.
|
* @return True if success, false if failure.
|
||||||
*/
|
*/
|
||||||
@ -361,7 +357,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the world from the Multiverse list and from the config
|
* Remove the world from the Multiverse list and from the config
|
||||||
*
|
*
|
||||||
* @param name The name of the world to remove
|
* @param name The name of the world to remove
|
||||||
* @return True if success, false if failure.
|
* @return True if success, false if failure.
|
||||||
*/
|
*/
|
||||||
@ -374,7 +370,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the world from the Multiverse list, from the config and deletes the folder
|
* Remove the world from the Multiverse list, from the config and deletes the folder
|
||||||
*
|
*
|
||||||
* @param name The name of the world to remove
|
* @param name The name of the world to remove
|
||||||
* @return True if success, false if failure.
|
* @return True if success, false if failure.
|
||||||
*/
|
*/
|
||||||
@ -389,7 +385,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a folder Courtesy of: lithium3141
|
* Delete a folder Courtesy of: lithium3141
|
||||||
*
|
*
|
||||||
* @param file The folder to delete
|
* @param file The folder to delete
|
||||||
* @return true if success
|
* @return true if success
|
||||||
*/
|
*/
|
||||||
@ -415,12 +411,15 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
debugLog.close();
|
debugLog.close();
|
||||||
|
this.ph.setPermissions(null);
|
||||||
|
this.banker = null;
|
||||||
|
this.bank = null;
|
||||||
log(Level.INFO, "- Disabled");
|
log(Level.INFO, "- Disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grab the players session if one exists, otherwise create a session then return it.
|
* Grab the players session if one exists, otherwise create a session then return it.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -435,7 +434,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Grab and return the Teleport class.
|
* Grab and return the Teleport class.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public MVTeleport getTeleporter() {
|
public MVTeleport getTeleporter() {
|
||||||
@ -462,12 +461,14 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
sender.sendMessage("This plugin is Disabled!");
|
sender.sendMessage("This plugin is Disabled!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return this.commandManager.dispatch(sender, command, commandLabel, args);
|
ArrayList<String> allArgs = new ArrayList<String>(Arrays.asList(args));
|
||||||
|
allArgs.add(0, command.getName());
|
||||||
|
return this.commandHandler.locateAndRunCommand(sender, allArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print messages to the server Log as well as to our DebugLog. 'debugLog' is used to seperate Heroes information from the Servers Log Output.
|
* Print messages to the server Log as well as to our DebugLog. 'debugLog' is used to seperate Heroes information from the Servers Log Output.
|
||||||
*
|
*
|
||||||
* @param level
|
* @param level
|
||||||
* @param msg
|
* @param msg
|
||||||
*/
|
*/
|
||||||
@ -478,7 +479,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Print messages to the Debug Log, if the servers in Debug Mode then we also wan't to print the messages to the standard Server Console.
|
* Print messages to the Debug Log, if the servers in Debug Mode then we also wan't to print the messages to the standard Server Console.
|
||||||
*
|
*
|
||||||
* @param level
|
* @param level
|
||||||
* @param msg
|
* @param msg
|
||||||
*/
|
*/
|
||||||
@ -491,7 +492,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the Authors Array into a readable String with ',' and 'and'.
|
* Parse the Authors Array into a readable String with ',' and 'and'.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String getAuthors() {
|
private String getAuthors() {
|
||||||
@ -512,8 +513,8 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
return authors.substring(2);
|
return authors.substring(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandManager getCommandManager() {
|
public CommandHandler getCommandHandler() {
|
||||||
return this.commandManager;
|
return this.commandHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTag() {
|
public String getTag() {
|
||||||
@ -522,7 +523,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This code should get moved somewhere more appropriate, but for now, it's here.
|
* This code should get moved somewhere more appropriate, but for now, it's here.
|
||||||
*
|
*
|
||||||
* @param env
|
* @param env
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -554,10 +555,35 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
if (this.worlds.containsKey(name)) {
|
if (this.worlds.containsKey(name)) {
|
||||||
return this.worlds.get(name);
|
return this.worlds.get(name);
|
||||||
}
|
}
|
||||||
|
return this.getMVWorldByAlias(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
private MVWorld getMVWorldByAlias(String alias) {
|
||||||
|
for (MVWorld w : this.worlds.values()) {
|
||||||
|
if (w.getAlias().equalsIgnoreCase(alias)) {
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMVWorld(String name) {
|
public boolean isMVWorld(String name) {
|
||||||
return this.worlds.containsKey(name);
|
return (this.worlds.containsKey(name) || isMVWorldAlias(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method ONLY checks the alias of each world.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isMVWorldAlias(String name) {
|
||||||
|
for (MVWorld w : this.worlds.values()) {
|
||||||
|
if (w.getAlias().equalsIgnoreCase(name)) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,102 +0,0 @@
|
|||||||
package com.onarandombox.MultiverseCore.command;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
|
||||||
|
|
||||||
public abstract class BaseCommand {
|
|
||||||
|
|
||||||
protected MultiverseCore plugin;
|
|
||||||
protected String name;
|
|
||||||
protected String description;
|
|
||||||
protected String usage;
|
|
||||||
protected String permission = "";
|
|
||||||
protected boolean requiresOp;
|
|
||||||
protected int minArgs;
|
|
||||||
protected int maxArgs;
|
|
||||||
protected List<String> identifiers;
|
|
||||||
|
|
||||||
public final String IN_GAME_COMMAND_MSG = "This command needs to be used as a Player in game.";
|
|
||||||
|
|
||||||
public BaseCommand(MultiverseCore plugin) {
|
|
||||||
this.identifiers = new ArrayList<String>();
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void execute(CommandSender sender, String[] args);
|
|
||||||
|
|
||||||
public boolean validate(String name, String[] parsedArgs, StringBuilder identifier) {
|
|
||||||
String match = this.matchIdentifier(name, parsedArgs);
|
|
||||||
if (match != null) {
|
|
||||||
identifier = identifier.append(match);
|
|
||||||
if (parsedArgs == null) {
|
|
||||||
parsedArgs = new String[0];
|
|
||||||
}
|
|
||||||
int l = parsedArgs.length;
|
|
||||||
if (l >= this.minArgs && (this.maxArgs == -1 || l <= this.maxArgs)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String matchIdentifier(String input, String[] args) {
|
|
||||||
|
|
||||||
String argsString = this.getArgsString(args);
|
|
||||||
String lower = input.toLowerCase() + argsString;
|
|
||||||
int index = -1;
|
|
||||||
int n = this.identifiers.size();
|
|
||||||
for (int i = 0; i < n; i++) {
|
|
||||||
String identifier = this.identifiers.get(i).toLowerCase();
|
|
||||||
if (index == -1 && lower.matches(identifier + "(\\s+.*|\\s*)")) {
|
|
||||||
index = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (index != -1) {
|
|
||||||
return this.identifiers.get(index);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getArgsString(String[] args) {
|
|
||||||
String returnString = "";
|
|
||||||
for (String s : args) {
|
|
||||||
returnString += " " + s;
|
|
||||||
}
|
|
||||||
return returnString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getIdentifiers() {
|
|
||||||
return this.identifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIdentifiers(List<String> identifiers) {
|
|
||||||
this.identifiers = identifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsage() {
|
|
||||||
return this.usage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOpRequired() {
|
|
||||||
return this.requiresOp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPermission() {
|
|
||||||
return this.permission;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,221 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) 2011 DThielke <dave.thielke@gmail.com>
|
|
||||||
*
|
|
||||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
|
|
||||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/ or send a letter to
|
|
||||||
* Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
|
|
||||||
**/
|
|
||||||
|
|
||||||
package com.onarandombox.MultiverseCore.command;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
|
||||||
|
|
||||||
public class CommandManager {
|
|
||||||
|
|
||||||
protected List<BaseCommand> commands;
|
|
||||||
private MultiverseCore plugin;
|
|
||||||
|
|
||||||
// List to hold commands that require approval
|
|
||||||
public List<QueuedCommand> queuedCommands = new ArrayList<QueuedCommand>();
|
|
||||||
|
|
||||||
public CommandManager(MultiverseCore plugin) {
|
|
||||||
this.commands = new ArrayList<BaseCommand>();
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean dispatch(CommandSender sender, Command command, String label, String[] args) {
|
|
||||||
|
|
||||||
BaseCommand match = null;
|
|
||||||
String[] trimmedArgs = null;
|
|
||||||
StringBuilder identifier = new StringBuilder();
|
|
||||||
|
|
||||||
for (BaseCommand cmd : this.commands) {
|
|
||||||
StringBuilder tmpIdentifier = new StringBuilder();
|
|
||||||
String[] tmpArgs = parseAllQuotedStrings(args);
|
|
||||||
|
|
||||||
if (match == null) {
|
|
||||||
match = cmd.matchIdentifier(label, tmpArgs) == null ? null : cmd;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (match != null && cmd.validate(label, tmpArgs, tmpIdentifier) && tmpIdentifier.length() > identifier.length()) {
|
|
||||||
identifier = tmpIdentifier;
|
|
||||||
trimmedArgs = tmpArgs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match != null) {
|
|
||||||
if (this.plugin.ph.hasPermission(sender, match.getPermission(), match.isOpRequired())) {
|
|
||||||
if (trimmedArgs != null) {
|
|
||||||
match.execute(sender, trimmedArgs);
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.AQUA + "Command: " + ChatColor.WHITE + match.getName());
|
|
||||||
sender.sendMessage(ChatColor.AQUA + "Description: " + ChatColor.WHITE + match.getDescription());
|
|
||||||
sender.sendMessage(ChatColor.AQUA + "Usage: " + ChatColor.WHITE + match.getUsage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("You do not have permission to use this command. (" + match.getPermission() + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addCommand(BaseCommand command) {
|
|
||||||
this.commands.add(command);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeCommand(BaseCommand command) {
|
|
||||||
this.commands.remove(command);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public List<BaseCommand> getCommands() {
|
|
||||||
return this.commands;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<BaseCommand> getCommands(CommandSender sender) {
|
|
||||||
ArrayList<BaseCommand> playerCommands = new ArrayList<BaseCommand>();
|
|
||||||
for(BaseCommand c : this.commands) {
|
|
||||||
if(this.plugin.ph.hasPermission(sender, c.permission, c.isOpRequired())) {
|
|
||||||
playerCommands.add(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return playerCommands;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Combines all quoted strings
|
|
||||||
*
|
|
||||||
* @param args
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private String[] parseAllQuotedStrings(String[] args) {
|
|
||||||
// TODO: Allow '
|
|
||||||
ArrayList<String> newArgs = new ArrayList<String>();
|
|
||||||
// Iterate through all command params:
|
|
||||||
// we could have: "Fish dog" the man bear pig "lives today" and maybe "even tomorrow" or "the" next day
|
|
||||||
int start = -1;
|
|
||||||
for (int i = 0; i < args.length; i++) {
|
|
||||||
|
|
||||||
// If we aren't looking for an end quote, and the first part of a string is a quote
|
|
||||||
if (start == -1 && args[i].substring(0, 1).equals("\"")) {
|
|
||||||
start = i;
|
|
||||||
}
|
|
||||||
// Have to keep this seperate for one word quoted strings like: "fish"
|
|
||||||
if (start != -1 && args[i].substring(args[i].length() - 1, args[i].length()).equals("\"")) {
|
|
||||||
// Now we've found the second part of a string, let's parse the quoted one out
|
|
||||||
// Make sure it's i+1, we still want I included
|
|
||||||
newArgs.add(parseQuotedString(args, start, i + 1));
|
|
||||||
// Reset the start to look for more!
|
|
||||||
start = -1;
|
|
||||||
} else if (start == -1) {
|
|
||||||
// This is a word that is NOT enclosed in any quotes, so just add it
|
|
||||||
newArgs.add(args[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If the string was ended but had an open quote...
|
|
||||||
if (start != -1) {
|
|
||||||
// ... then we want to close that quote and make that one arg.
|
|
||||||
newArgs.add(parseQuotedString(args, start, args.length));
|
|
||||||
}
|
|
||||||
|
|
||||||
return newArgs.toArray(new String[newArgs.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Takes a string array and returns a combined string, excluding the stop position, including the start
|
|
||||||
*
|
|
||||||
* @param args
|
|
||||||
* @param start
|
|
||||||
* @param stop
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private String parseQuotedString(String[] args, int start, int stop) {
|
|
||||||
String returnVal = args[start];
|
|
||||||
for (int i = start + 1; i < stop; i++) {
|
|
||||||
returnVal += " " + args[i];
|
|
||||||
}
|
|
||||||
return returnVal.replace("\"", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the given flag value
|
|
||||||
*
|
|
||||||
* @param flag A param flag, like -s or -g
|
|
||||||
* @param args All arguments to search through
|
|
||||||
* @return A string or null
|
|
||||||
*/
|
|
||||||
public static String getFlag(String flag, String[] args) {
|
|
||||||
int i = 0;
|
|
||||||
try {
|
|
||||||
for (String s : args) {
|
|
||||||
if (s.equalsIgnoreCase(flag)) {
|
|
||||||
return args[i + 1];
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
} catch (IndexOutOfBoundsException e) {
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void queueCommand(CommandSender sender, String commandName, String methodName, String[] args, Class<?>[] paramTypes, String success, String fail) {
|
|
||||||
cancelQueuedCommand(sender);
|
|
||||||
this.queuedCommands.add(new QueuedCommand(methodName, args, paramTypes, sender, Calendar.getInstance(), this.plugin, success, fail));
|
|
||||||
sender.sendMessage("The command " + ChatColor.RED + commandName + ChatColor.WHITE + " has been halted due to the fact that it could break something!");
|
|
||||||
sender.sendMessage("If you still wish to execute " + ChatColor.RED + commandName + ChatColor.WHITE);
|
|
||||||
sender.sendMessage("please type: " + ChatColor.GREEN + "/mvconfirm");
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "/mvconfirm" + ChatColor.WHITE + " will only be available for 10 seconds.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tries to fire off the command
|
|
||||||
*
|
|
||||||
* @param sender
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean confirmQueuedCommand(CommandSender sender) {
|
|
||||||
for (QueuedCommand com : this.queuedCommands) {
|
|
||||||
if (com.getSender().equals(sender)) {
|
|
||||||
if (com.execute()) {
|
|
||||||
sender.sendMessage(com.getSuccess());
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(com.getFail());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancels(invalidates) a command that has been requested. This is called when a user types something other than 'yes' or when they try to queue a second command Queuing a second command will delete the first command entirely.
|
|
||||||
*
|
|
||||||
* @param sender
|
|
||||||
*/
|
|
||||||
public void cancelQueuedCommand(CommandSender sender) {
|
|
||||||
QueuedCommand c = null;
|
|
||||||
for (QueuedCommand com : this.queuedCommands) {
|
|
||||||
if (com.getSender().equals(sender)) {
|
|
||||||
c = com;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (c != null) {
|
|
||||||
// Each person is allowed at most one queued command.
|
|
||||||
this.queuedCommands.remove(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
package com.onarandombox.MultiverseCore.command;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
|
||||||
|
|
||||||
public class QueuedCommand {
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private Object[] args;
|
|
||||||
private Class<?> paramTypes[];
|
|
||||||
private CommandSender sender;
|
|
||||||
private MultiverseCore plugin;
|
|
||||||
private Calendar timeRequested;
|
|
||||||
private String success;
|
|
||||||
private String fail;
|
|
||||||
|
|
||||||
public QueuedCommand(String commandName, Object[] args, Class<?> partypes[], CommandSender sender, Calendar instance, MultiverseCore plugin, String success, String fail) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.name = commandName;
|
|
||||||
this.args = args;
|
|
||||||
this.sender = sender;
|
|
||||||
this.timeRequested = instance;
|
|
||||||
this.paramTypes = partypes;
|
|
||||||
this.setSuccess(success);
|
|
||||||
this.setFail(fail);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandSender getSender() {
|
|
||||||
return this.sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean execute() {
|
|
||||||
this.timeRequested.add(Calendar.SECOND, 10);
|
|
||||||
if (this.timeRequested.after(Calendar.getInstance())) {
|
|
||||||
try {
|
|
||||||
Method method = this.plugin.getClass().getMethod(this.name, this.paramTypes);
|
|
||||||
try {
|
|
||||||
method.invoke(this.plugin, this.args);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
this.sender.sendMessage("This command has expried. Please type the original command again.");
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setSuccess(String success) {
|
|
||||||
this.success = success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuccess() {
|
|
||||||
return this.success;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setFail(String fail) {
|
|
||||||
this.fail = fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFail() {
|
|
||||||
return this.fail;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
|
||||||
|
|
||||||
public class ConfirmCommand extends BaseCommand {
|
|
||||||
|
|
||||||
public ConfirmCommand(MultiverseCore plugin) {
|
|
||||||
super(plugin);
|
|
||||||
this.name = "Confirms a command that could destroy life, the universe and everything.";
|
|
||||||
this.description = "If you have not been prompted to use this, it will not do anything.";
|
|
||||||
this.usage = "/mvconfirm";
|
|
||||||
this.minArgs = 0;
|
|
||||||
this.maxArgs = 0;
|
|
||||||
this.identifiers.add("mvconfirm");
|
|
||||||
this.permission = "multiverse.world.confirm";
|
|
||||||
// Any command that is dangerous should require op
|
|
||||||
this.requiresOp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
|
||||||
this.plugin.getCommandManager().confirmQueuedCommand(sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
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);
|
|
||||||
this.name = "Delete World";
|
|
||||||
this.description = "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY.";
|
|
||||||
this.usage = "/mvdelete" + ChatColor.GREEN + " {WORLD} ";
|
|
||||||
this.minArgs = 1;
|
|
||||||
this.maxArgs = 1;
|
|
||||||
this.identifiers.add("mvdelete");
|
|
||||||
this.permission = "multiverse.world.delete";
|
|
||||||
this.requiresOp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
|
||||||
Class<?> paramTypes[] = {String.class};
|
|
||||||
this.plugin.getCommandManager().queueCommand(sender, "mvdelete", "deleteWorld", args, paramTypes, "World Deleted!", "World was not deleted!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MVWorld;
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
|
||||||
import com.onarandombox.utils.PurgeWorlds;
|
|
||||||
|
|
||||||
public class PurgeCommand extends BaseCommand {
|
|
||||||
|
|
||||||
public PurgeCommand(MultiverseCore plugin) {
|
|
||||||
super(plugin);
|
|
||||||
this.name = "Purge the world ";
|
|
||||||
this.description = "Removed the specified type of mob from the specified world.";
|
|
||||||
this.usage = "/mvpurge" + ChatColor.GOLD + " [WORLD|all] " + ChatColor.GREEN + "{all|animals|monsters|MOBNAME}";
|
|
||||||
this.minArgs = 1;
|
|
||||||
this.maxArgs = 2;
|
|
||||||
this.identifiers.add("mvpurge");
|
|
||||||
this.permission = "multiverse.world.purge";
|
|
||||||
this.requiresOp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
|
||||||
Player p = null;
|
|
||||||
if(sender instanceof Player) {
|
|
||||||
p = (Player) sender;
|
|
||||||
}
|
|
||||||
if (args.length == 1 && p == null) {
|
|
||||||
sender.sendMessage("This command requires a WORLD when being run from the console!");
|
|
||||||
sender.sendMessage(this.usage);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String worldName = null;
|
|
||||||
String deathName = null;
|
|
||||||
if(args.length == 1) {
|
|
||||||
worldName = p.getWorld().getName();
|
|
||||||
deathName = args[0];
|
|
||||||
} else {
|
|
||||||
worldName = args[0];
|
|
||||||
deathName = args[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this.plugin.isMVWorld(worldName)) {
|
|
||||||
sender.sendMessage("Multiverse doesn't know about " + worldName);
|
|
||||||
sender.sendMessage("... so It cannot be purged");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MVWorld world = this.plugin.getMVWorld(worldName);
|
|
||||||
|
|
||||||
PurgeWorlds purger = this.plugin.getWorldPurger();
|
|
||||||
ArrayList<String> thingsToKill = new ArrayList<String>();
|
|
||||||
if(deathName.equalsIgnoreCase("all") || deathName.equalsIgnoreCase("animals") || deathName.equalsIgnoreCase("monsters")) {
|
|
||||||
thingsToKill.add(deathName.toUpperCase());
|
|
||||||
} else {
|
|
||||||
Collections.addAll(thingsToKill, deathName.toUpperCase().split(","));
|
|
||||||
}
|
|
||||||
purger.purgeWorld(sender, world, thingsToKill, false, false);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
|
||||||
|
|
||||||
public class ReloadCommand extends BaseCommand {
|
|
||||||
|
|
||||||
public ReloadCommand(MultiverseCore plugin) {
|
|
||||||
super(plugin);
|
|
||||||
this.name = "Reload worlds.yml";
|
|
||||||
this.description = "Reloads all worlds that are in worlds.yml. Use this if you've modified worlds.yml.";
|
|
||||||
this.usage = "/mvreload";
|
|
||||||
this.minArgs = 0;
|
|
||||||
this.maxArgs = 0;
|
|
||||||
this.identifiers.add("mvreload");
|
|
||||||
this.permission = "multiverse.world.reload";
|
|
||||||
this.requiresOp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
|
||||||
this.plugin.log(Level.INFO, "Reloading Multiverse-Core config");
|
|
||||||
this.plugin.loadConfigs();
|
|
||||||
this.plugin.loadWorlds(true);
|
|
||||||
this.plugin.log(Level.INFO, "Reload Complete!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
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);
|
|
||||||
this.name = "Remove World";
|
|
||||||
this.description = "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder.";
|
|
||||||
this.usage = "/mvremove" + ChatColor.GREEN + " {WORLD} ";
|
|
||||||
this.minArgs = 1;
|
|
||||||
this.maxArgs = 1;
|
|
||||||
this.identifiers.add("mvremove");
|
|
||||||
this.permission = "multiverse.world.remove";
|
|
||||||
this.requiresOp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
|
||||||
if (this.plugin.removeWorld(args[0])) {
|
|
||||||
sender.sendMessage("World removed from config!");
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Error trying to remove world from config!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
|
||||||
|
|
||||||
public class SetSpawnCommand extends BaseCommand {
|
|
||||||
|
|
||||||
public SetSpawnCommand(MultiverseCore plugin) {
|
|
||||||
super(plugin);
|
|
||||||
this.name = "Set World Spawn";
|
|
||||||
this.description = "Sets the spawn for the current world.";
|
|
||||||
this.usage = "/mvsetspawn";
|
|
||||||
this.minArgs = 0;
|
|
||||||
this.maxArgs = 0;
|
|
||||||
this.identifiers.add("mvsetspawn");
|
|
||||||
this.permission = "multiverse.world.spawn.set";
|
|
||||||
this.requiresOp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
|
||||||
if (sender instanceof Player) {
|
|
||||||
Player p = (Player) sender;
|
|
||||||
Location l = p.getLocation();
|
|
||||||
World w = p.getWorld();
|
|
||||||
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
|
|
||||||
p.sendMessage(w.getName() + " - Spawn set to X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ());
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(this.IN_GAME_COMMAND_MSG);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
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);
|
|
||||||
this.name = "Unload World";
|
|
||||||
this.description = "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.";
|
|
||||||
this.usage = "/mvunload" + ChatColor.GREEN + " {WORLD} ";
|
|
||||||
this.minArgs = 1;
|
|
||||||
this.maxArgs = 1;
|
|
||||||
this.identifiers.add("mvunload");
|
|
||||||
this.permission = "multiverse.world.unload";
|
|
||||||
this.requiresOp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
|
||||||
if (this.plugin.unloadWorld(args[0])) {
|
|
||||||
sender.sendMessage("World Unloaded!");
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Error trying to unload world!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class ConfirmCommand extends Command {
|
||||||
|
|
||||||
|
public ConfirmCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Confirms a command that could destroy life, the universe and everything.";
|
||||||
|
this.commandDesc = "If you have not been prompted to use this, it will not do anything.";
|
||||||
|
this.commandUsage = "/mvconfirm";
|
||||||
|
this.minimumArgLength = 0;
|
||||||
|
this.maximumArgLength = 0;
|
||||||
|
this.commandKeys.add("mvconfirm");
|
||||||
|
this.permission = "multiverse.world.confirm";
|
||||||
|
// Any command that is dangerous should require op
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
((MultiverseCore) this.plugin).getCommandHandler().confirmQueuedCommand(sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,6 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -6,30 +8,32 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
|
||||||
import com.onarandombox.utils.LocationManipulation;
|
import com.onarandombox.utils.LocationManipulation;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
public class CoordCommand extends BaseCommand {
|
public class CoordCommand extends Command {
|
||||||
|
|
||||||
private LocationManipulation locMan = new LocationManipulation();
|
private LocationManipulation locMan = new LocationManipulation();
|
||||||
|
|
||||||
public CoordCommand(MultiverseCore plugin) {
|
public CoordCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.name = "Coordinates";
|
this.commandName = "Coordinates";
|
||||||
this.description = "Returns detailed information on the Players where abouts.";
|
this.commandDesc = "Returns detailed information on the Players where abouts.";
|
||||||
this.usage = "/mvcoord";
|
this.commandUsage = "/mvcoord";
|
||||||
this.minArgs = 0;
|
this.minimumArgLength = 0;
|
||||||
this.maxArgs = 0;
|
this.maximumArgLength = 0;
|
||||||
this.identifiers.add("mvcoord");
|
this.commandKeys.add("mvcoord");
|
||||||
|
this.permission = "multiverse.world.coord";
|
||||||
|
this.opRequired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
// Check if the command was sent from a Player.
|
// Check if the command was sent from a Player.
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
p.sendMessage(ChatColor.RED + "World: " + ChatColor.WHITE + p.getWorld().getName());
|
p.sendMessage(ChatColor.RED + "World: " + ChatColor.WHITE + p.getWorld().getName());
|
||||||
p.sendMessage(ChatColor.RED + "World Scale: " + ChatColor.WHITE + this.plugin.getMVWorld(p.getWorld().getName()).getScaling());
|
p.sendMessage(ChatColor.RED + "World Scale: " + ChatColor.WHITE + ((MultiverseCore) this.plugin).getMVWorld(p.getWorld().getName()).getScaling());
|
||||||
p.sendMessage(ChatColor.RED + "Coordinates: " + ChatColor.WHITE + this.locMan.strCoords(p.getLocation()));
|
p.sendMessage(ChatColor.RED + "Coordinates: " + ChatColor.WHITE + this.locMan.strCoords(p.getLocation()));
|
||||||
p.sendMessage(ChatColor.RED + "Direction: " + ChatColor.WHITE + this.locMan.getDirection(p.getLocation()));
|
p.sendMessage(ChatColor.RED + "Direction: " + ChatColor.WHITE + this.locMan.getDirection(p.getLocation()));
|
||||||
p.sendMessage(ChatColor.RED + "Block: " + ChatColor.WHITE + Material.getMaterial(p.getWorld().getBlockTypeIdAt(p.getLocation())));
|
p.sendMessage(ChatColor.RED + "Block: " + ChatColor.WHITE + Material.getMaterial(p.getWorld().getBlockTypeIdAt(p.getLocation())));
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||||
|
|
||||||
|
public class CreateCommand extends Command {
|
||||||
|
|
||||||
|
public CreateCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Create World";
|
||||||
|
this.commandDesc = "Creates a new world and loads it.";
|
||||||
|
this.commandUsage = "/mvcreate" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]]";
|
||||||
|
this.minimumArgLength = 2;
|
||||||
|
this.maximumArgLength = 6;
|
||||||
|
this.commandKeys.add("mvcreate");
|
||||||
|
this.commandKeys.add("mvc");
|
||||||
|
this.commandKeys.add("mv create");
|
||||||
|
this.permission = "multiverse.world.create";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
if (args.size() % 2 != 0) {
|
||||||
|
sender.sendMessage("You must preface your SEED with -s OR your GENERATOR with -g. Type /mv for help");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String worldName = args.get(0);
|
||||||
|
String env = args.get(1);
|
||||||
|
String seed = CommandHandler.getFlag("-s", args);
|
||||||
|
String generator = CommandHandler.getFlag("-g", args);
|
||||||
|
|
||||||
|
if (new File(worldName).exists() || ((MultiverseCore) this.plugin).isMVWorld(worldName)) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "A Folder/World already exists with this name!");
|
||||||
|
sender.sendMessage(ChatColor.RED + "If you are confident it is a world you can import with /mvimport");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Environment environment = ((MultiverseCore) this.plugin).getEnvFromString(env);
|
||||||
|
if (environment == null) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
|
||||||
|
EnvironmentCommand.showEnvironments(sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sender.sendMessage(ChatColor.AQUA + "Starting world creation...");
|
||||||
|
if (((MultiverseCore) this.plugin).addWorld(worldName, environment, seed, generator)) {
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "Complete!");
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "FAILED.");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class DeleteCommand extends Command {
|
||||||
|
|
||||||
|
public DeleteCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Delete World";
|
||||||
|
this.commandDesc = "Deletes a world on your server. " + ChatColor.RED + "PERMANENTLY.";
|
||||||
|
this.commandUsage = "/mvdelete" + ChatColor.GREEN + " {WORLD} ";
|
||||||
|
this.minimumArgLength = 1;
|
||||||
|
this.maximumArgLength = 1;
|
||||||
|
this.commandKeys.add("mvdelete");
|
||||||
|
this.commandKeys.add("mv delete");
|
||||||
|
this.permission = "multiverse.world.delete";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
Class<?> paramTypes[] = {String.class};
|
||||||
|
((MultiverseCore) this.plugin).getCommandHandler().queueCommand(sender, "mvdelete", "deleteWorld", args, paramTypes, "World Deleted!", "World was not deleted!");
|
||||||
|
}
|
||||||
|
}
|
@ -1,29 +1,28 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
public class EnvironmentCommand extends BaseCommand{
|
public class EnvironmentCommand extends Command {
|
||||||
|
|
||||||
public EnvironmentCommand(MultiverseCore plugin) {
|
public EnvironmentCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.name = "List Environments";
|
this.commandName = "List Environments";
|
||||||
this.description = "Lists valid known environments.";
|
this.commandDesc = "Lists valid known environments";
|
||||||
this.usage = "/mvenv";
|
this.commandUsage = "/mvenv";
|
||||||
this.minArgs = 0;
|
this.minimumArgLength = 0;
|
||||||
this.maxArgs = 0;
|
this.maximumArgLength = 0;
|
||||||
this.identifiers.add("mvenv");
|
this.commandKeys.add("mvenv");
|
||||||
|
this.commandKeys.add("mv env");
|
||||||
this.permission = "multiverse.world.list.environments";
|
this.permission = "multiverse.world.list.environments";
|
||||||
this.requiresOp = false;
|
this.opRequired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
|
||||||
EnvironmentCommand.showEnvironments(sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showEnvironments(CommandSender sender) {
|
public static void showEnvironments(CommandSender sender) {
|
||||||
sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
|
sender.sendMessage(ChatColor.YELLOW + "Valid Environments are:");
|
||||||
@ -32,4 +31,8 @@ public class EnvironmentCommand extends BaseCommand{
|
|||||||
sender.sendMessage(ChatColor.AQUA + "SKYLANDS");
|
sender.sendMessage(ChatColor.AQUA + "SKYLANDS");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
EnvironmentCommand.showEnvironments(sender);
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
// This file is no longer licensed under that silly CC license. I have blanked it out and will start implementaiton of my own in a few days. For now there is no help.
|
||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class HelpCommand extends Command {
|
||||||
|
private static final int CMDS_PER_PAGE = 7;
|
||||||
|
|
||||||
|
public HelpCommand(JavaPlugin plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Get Help with Multiverse";
|
||||||
|
this.commandDesc = "Displays a nice help menu";
|
||||||
|
this.commandUsage = "/mv " + ChatColor.GOLD + "[PAGE #]";
|
||||||
|
this.minimumArgLength = 0;
|
||||||
|
this.maximumArgLength = 1;
|
||||||
|
this.commandKeys.add("mv");
|
||||||
|
this.commandKeys.add("mvhelp");
|
||||||
|
this.commandKeys.add("mv help");
|
||||||
|
this.permission = "multiverse.help";
|
||||||
|
this.opRequired = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
sender.sendMessage(ChatColor.AQUA + "====[ Multiverse Help ]====");
|
||||||
|
|
||||||
|
|
||||||
|
int page = 1;
|
||||||
|
if (args.size() == 1) {
|
||||||
|
try {
|
||||||
|
page = Integer.parseInt(args.get(0));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Command> availableCommands = new ArrayList<Command>(((MultiverseCore) this.plugin).getCommandHandler().getCommands(sender));
|
||||||
|
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
|
||||||
|
for (Command c : availableCommands) {
|
||||||
|
sender.sendMessage(ChatColor.AQUA + c.getCommandUsage());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalPages = (int) Math.ceil(availableCommands.size() / (CMDS_PER_PAGE + 0.0));
|
||||||
|
|
||||||
|
if (page > totalPages) {
|
||||||
|
page = totalPages;
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(ChatColor.AQUA + " Page " + page + " of " + totalPages);
|
||||||
|
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
|
||||||
|
|
||||||
|
this.showPage(page, sender, availableCommands);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPage(int page, CommandSender sender, List<Command> cmds) {
|
||||||
|
int start = (page - 1) * CMDS_PER_PAGE;
|
||||||
|
int end = start + CMDS_PER_PAGE;
|
||||||
|
for (int i = start; i < end; i++) {
|
||||||
|
// For consistancy, print some extra lines if it's a player:
|
||||||
|
if (i < cmds.size()) {
|
||||||
|
sender.sendMessage(ChatColor.AQUA + cmds.get(i).getCommandUsage());
|
||||||
|
} else if (sender instanceof Player) {
|
||||||
|
sender.sendMessage(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,44 +1,47 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
public class ImportCommand extends BaseCommand {
|
public class ImportCommand extends Command {
|
||||||
|
|
||||||
public ImportCommand(MultiverseCore plugin) {
|
public ImportCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.name = "Import World";
|
this.commandName = "Import World";
|
||||||
this.description = "Imports a new world of the specified type.";
|
this.commandDesc = "Imports a new world of the specified type";
|
||||||
this.usage = "/mvimport" + ChatColor.GREEN + " {NAME} {ENV} " + ChatColor.GOLD + "[GENERATOR[:ID]]";
|
this.commandUsage = "/mvimport" + ChatColor.GREEN + " {NAME} {ENV} " + ChatColor.GOLD + "[GENERATOR[:ID]]";
|
||||||
this.minArgs = 2;
|
this.minimumArgLength = 2;
|
||||||
this.maxArgs = 3;
|
this.maximumArgLength = 3;
|
||||||
this.identifiers.add("mvimport");
|
this.commandKeys.add("mvimport");
|
||||||
|
this.commandKeys.add("mvi");
|
||||||
|
this.commandKeys.add("mv import");
|
||||||
this.permission = "multiverse.world.import";
|
this.permission = "multiverse.world.import";
|
||||||
this.requiresOp = true;
|
this.opRequired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
String worldName = args[0];
|
String worldName = args.get(0);
|
||||||
if (this.plugin.isMVWorld(worldName) && new File(worldName).exists()) {
|
if (((MultiverseCore) this.plugin).isMVWorld(worldName) && new File(worldName).exists()) {
|
||||||
sender.sendMessage(ChatColor.RED + "Multiverse already knows about this world!");
|
sender.sendMessage(ChatColor.RED + "Multiverse already knows about this world!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String generator = null;
|
String generator = null;
|
||||||
if(args.length == 3) {
|
if (args.size() == 3) {
|
||||||
generator = args[2];
|
generator = args.get(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
String env = args[1];
|
String env = args.get(1);
|
||||||
Environment environment = this.plugin.getEnvFromString(env);
|
Environment environment = ((MultiverseCore) this.plugin).getEnvFromString(env);
|
||||||
if(environment == null) {
|
if (environment == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
|
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
|
||||||
EnvironmentCommand.showEnvironments(sender);
|
EnvironmentCommand.showEnvironments(sender);
|
||||||
return;
|
return;
|
||||||
@ -46,10 +49,10 @@ public class ImportCommand extends BaseCommand {
|
|||||||
|
|
||||||
if (new File(worldName).exists() && env != null) {
|
if (new File(worldName).exists() && env != null) {
|
||||||
sender.sendMessage(ChatColor.AQUA + "Starting world import...");
|
sender.sendMessage(ChatColor.AQUA + "Starting world import...");
|
||||||
this.plugin.addWorld(worldName, environment, null, generator);
|
((MultiverseCore) this.plugin).addWorld(worldName, environment, null, generator);
|
||||||
sender.sendMessage(ChatColor.GREEN + "Complete!");
|
sender.sendMessage(ChatColor.GREEN + "Complete!");
|
||||||
return;
|
return;
|
||||||
} else if(env == null) {
|
} else if (env == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "FAILED.");
|
sender.sendMessage(ChatColor.RED + "FAILED.");
|
||||||
sender.sendMessage("That world type did not exist.");
|
sender.sendMessage("That world type did not exist.");
|
||||||
sender.sendMessage("For a list of available world types, type: /mvenv");
|
sender.sendMessage("For a list of available world types, type: /mvenv");
|
||||||
@ -58,5 +61,4 @@ public class ImportCommand extends BaseCommand {
|
|||||||
sender.sendMessage("That world folder does not exist...");
|
sender.sendMessage("That world folder does not exist...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -8,56 +9,61 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MVWorld;
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class InfoCommand extends Command {
|
||||||
|
|
||||||
public class InfoCommand extends BaseCommand {
|
|
||||||
|
|
||||||
public InfoCommand(MultiverseCore plugin) {
|
public InfoCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.name = "World Information";
|
this.commandName = "World Information";
|
||||||
this.description = "Returns detailed information on the world.";
|
this.commandDesc = "Returns detailed information on the world.";
|
||||||
this.usage = "/mvinfo" + ChatColor.GOLD + "[WORLD]" + ChatColor.DARK_PURPLE + "<Page #>";
|
this.commandUsage = "/mvinfo" + ChatColor.GOLD + " [WORLD] ";
|
||||||
this.minArgs = 0;
|
this.minimumArgLength = 0;
|
||||||
this.maxArgs = 2;
|
this.maximumArgLength = 2;
|
||||||
this.identifiers.add("mvinfo");
|
this.commandKeys.add("mvinfo");
|
||||||
|
this.commandKeys.add("mv info");
|
||||||
|
this.commandKeys.add("mvi");
|
||||||
this.permission = "multiverse.world.info";
|
this.permission = "multiverse.world.info";
|
||||||
this.requiresOp = false;
|
this.opRequired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
// Check if the command was sent from a Player.
|
// Check if the command was sent from a Player.
|
||||||
String worldName = "";
|
String worldName = "";
|
||||||
if (sender instanceof Player && args.length == 0) {
|
if (sender instanceof Player && args.size() == 0) {
|
||||||
worldName = ((Player) sender).getWorld().getName();
|
worldName = ((Player) sender).getWorld().getName();
|
||||||
} else if (args.length == 0) {
|
} else if (args.size() == 0) {
|
||||||
sender.sendMessage("You must enter a" + ChatColor.GOLD + " world" + ChatColor.WHITE + " from the console!");
|
sender.sendMessage("You must enter a" + ChatColor.GOLD + " world" + ChatColor.WHITE + " from the console!");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
worldName = args[0];
|
worldName = args.get(0);
|
||||||
}
|
}
|
||||||
if (this.plugin.isMVWorld(worldName)) {
|
if (((MultiverseCore) this.plugin).isMVWorld(worldName)) {
|
||||||
for (String s : buildEntireCommand(this.plugin.getMVWorld(worldName))) {
|
for (String s : buildEntireCommand(((MultiverseCore) this.plugin).getMVWorld(worldName))) {
|
||||||
sender.sendMessage(s);
|
sender.sendMessage(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] buildEntireCommand(MVWorld world) {
|
private List<String> buildEntireCommand(MVWorld world) {
|
||||||
StringBuilder sb = new StringBuilder();
|
List<String> page = new ArrayList<String>();
|
||||||
ArrayList<String[]> pagedInfo = new ArrayList<String[]>();
|
|
||||||
String[] aPage = new String[5];
|
|
||||||
// World Name: 1
|
// World Name: 1
|
||||||
aPage[0] = "World: " + world.getName();
|
page.add("World: " + world.getName());
|
||||||
|
|
||||||
// World Scale: 1
|
// World Scale: 1
|
||||||
aPage[1] = "World Scale: " + world.getScaling();
|
page.add("World Scale: " + world.getScaling());
|
||||||
|
|
||||||
// PVP: 1
|
// PVP: 1
|
||||||
aPage[2] = "PVP: " + world.getPvp();
|
page.add("PVP (MV): " + world.getPvp());
|
||||||
aPage[3] = "Animals: " + world.allowAnimalSpawning();
|
page.add("PVP: " + world.getCBWorld().getPVP());
|
||||||
aPage[4] = "Monsters: " + world.allowMonsterSpawning();
|
page.add("Fake PVP: " + world.getFakePVP());
|
||||||
|
page.add("Animals (MV): " + world.allowAnimalSpawning());
|
||||||
|
page.add("Animals: " + world.getCBWorld().getAllowAnimals());
|
||||||
|
page.add("Monsters (MV): " + world.allowMonsterSpawning());
|
||||||
|
page.add("Monsters: " + world.getCBWorld().getAllowMonsters());
|
||||||
|
page.add("Respawn to: " + world.getRespawnToWorld());
|
||||||
|
|
||||||
// This feature is not mission critical and I am spending too much time on it...
|
// This feature is not mission critical and I am spending too much time on it...
|
||||||
// Stopping work on it for now --FF 20110623
|
// Stopping work on it for now --FF 20110623
|
||||||
// // Animal Spawning: X
|
// // Animal Spawning: X
|
||||||
@ -97,10 +103,11 @@ public class InfoCommand extends BaseCommand {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
return aPage;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ChatColor getChatColor(boolean positive) {
|
private ChatColor getChatColor(boolean positive) {
|
||||||
return positive ? ChatColor.GREEN : ChatColor.RED;
|
return positive ? ChatColor.GREEN : ChatColor.RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,6 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
@ -7,33 +9,35 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MVWorld;
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
public class ListCommand extends BaseCommand {
|
public class ListCommand extends Command {
|
||||||
|
|
||||||
public ListCommand(MultiverseCore plugin) {
|
public ListCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.name = "World Listing";
|
this.commandName = "World Listing";
|
||||||
this.description = "Displays a listing of all worlds that you can enter.";
|
this.commandDesc = "Displays a listing of all worlds that you can enter";
|
||||||
this.usage = "/mvlist";
|
this.commandUsage = "/mvlist";
|
||||||
this.minArgs = 0;
|
this.minimumArgLength = 0;
|
||||||
this.maxArgs = 0;
|
this.maximumArgLength = 0;
|
||||||
this.identifiers.add("mvlist");
|
this.commandKeys.add("mvlist");
|
||||||
|
this.commandKeys.add("mvl");
|
||||||
|
this.commandKeys.add("mv list");
|
||||||
this.permission = "multiverse.world.list";
|
this.permission = "multiverse.world.list";
|
||||||
this.requiresOp = false;
|
this.opRequired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
Player p = null;
|
Player p = null;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
p = (Player) sender;
|
p = (Player) sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n";
|
String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n";
|
||||||
for (MVWorld world : this.plugin.getMVWorlds()) {
|
for (MVWorld world : ((MultiverseCore) this.plugin).getMVWorlds()) {
|
||||||
|
|
||||||
if (p != null && (!this.plugin.ph.canEnterWorld(p, world.getCBWorld()))) {
|
if (p != null && (!((MultiverseCore) this.plugin).ph.canEnterWorld(p, world))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,11 +50,7 @@ public class ListCommand extends BaseCommand {
|
|||||||
} else if (env == Environment.SKYLANDS) {
|
} else if (env == Environment.SKYLANDS) {
|
||||||
color = ChatColor.AQUA;
|
color = ChatColor.AQUA;
|
||||||
}
|
}
|
||||||
String worldName = world.getName();
|
output += world.getColoredWorldString() + ChatColor.WHITE + " - " + color + world.getEnvironment() + " \n";
|
||||||
if(world.getAlias() != null && world.getAlias().length() > 0) {
|
|
||||||
worldName = world.getAliasColor() + world.getAlias() + ChatColor.WHITE;
|
|
||||||
}
|
|
||||||
output += ChatColor.WHITE + worldName + " - " + color + world.getEnvironment() + " \n";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
String[] response = output.split("\n");
|
String[] response = output.split("\n");
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
// This will contain all the properties that support the ADD/REMOVE
|
||||||
|
// Anything not in here will only support the SET action
|
||||||
|
|
||||||
|
public class ModifyAddCommand extends Command {
|
||||||
|
|
||||||
|
public ModifyAddCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Modify a World (Add a value)";
|
||||||
|
this.commandDesc = "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used";
|
||||||
|
this.commandUsage = "/mvmodify " + ChatColor.GREEN + "ADD {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] ";
|
||||||
|
this.minimumArgLength = 2;
|
||||||
|
this.maximumArgLength = 3;
|
||||||
|
this.commandKeys.add("mvmodify add");
|
||||||
|
this.commandKeys.add("mv modify add");
|
||||||
|
this.commandKeys.add("mvm add");
|
||||||
|
this.commandKeys.add("mvmadd");
|
||||||
|
this.permission = "multiverse.world.modify";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
// We NEED a world from the command line
|
||||||
|
Player p = null;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
p = (Player) sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 2 && p == null) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
|
||||||
|
sender.sendMessage(this.commandDesc);
|
||||||
|
sender.sendMessage(this.commandUsage);
|
||||||
|
sender.sendMessage("Nothing changed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MVWorld world;
|
||||||
|
String value = args.get(0);
|
||||||
|
String property = args.get(1);
|
||||||
|
|
||||||
|
if (args.size() == 2) {
|
||||||
|
world = ((MultiverseCore) this.plugin).getMVWorld(p.getWorld().getName());
|
||||||
|
} else {
|
||||||
|
world = ((MultiverseCore) this.plugin).getMVWorld(args.get(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (world == null) {
|
||||||
|
sender.sendMessage("That world does not exist!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ModifyCommand.validateAction(Action.Add, property)) {
|
||||||
|
sender.sendMessage("Sorry, you can't ADD to " + property);
|
||||||
|
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/4W8cY");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (world.addToList(property, value)) {
|
||||||
|
sender.sendMessage(value + " was added to " + property);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(value + " could not be added to " + property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class ModifyClearCommand extends Command {
|
||||||
|
|
||||||
|
public ModifyClearCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Modify a World (Clear a property)";
|
||||||
|
this.commandDesc = "Removes all values from a property. This will work on properties that contain lists";
|
||||||
|
this.commandUsage = "/mvmodify" + ChatColor.GREEN + " CLEAR {PROPERTY}" + ChatColor.GOLD + " [WORLD] ";
|
||||||
|
this.minimumArgLength = 1;
|
||||||
|
this.maximumArgLength = 2;
|
||||||
|
this.commandKeys.add("mvmodify clear");
|
||||||
|
this.commandKeys.add("mv modify clear");
|
||||||
|
this.commandKeys.add("mvm clear");
|
||||||
|
this.commandKeys.add("mvmclear");
|
||||||
|
this.permission = "multiverse.world.modify";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
// We NEED a world from the command line
|
||||||
|
Player p = null;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
p = (Player) sender;
|
||||||
|
}
|
||||||
|
if (args.size() == 1 && p == null) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
|
||||||
|
sender.sendMessage(this.commandDesc);
|
||||||
|
sender.sendMessage(this.commandUsage);
|
||||||
|
sender.sendMessage("Nothing changed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MVWorld world;
|
||||||
|
String property = args.get(0);
|
||||||
|
|
||||||
|
if (args.size() == 1) {
|
||||||
|
world = ((MultiverseCore) this.plugin).getMVWorld(p.getWorld().getName());
|
||||||
|
} else {
|
||||||
|
world = ((MultiverseCore) this.plugin).getMVWorld(args.get(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (world == null) {
|
||||||
|
sender.sendMessage("That world does not exist!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ModifyCommand.validateAction(Action.Clear, property)) {
|
||||||
|
sender.sendMessage("Sorry, you can't use CLEAR with " + property);
|
||||||
|
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/cgB2B");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (world.clearList(property)) {
|
||||||
|
sender.sendMessage(property + " was cleared. It contains 0 values now.");
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(property + " was NOT cleared.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,48 +1,42 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
enum AddProperties {
|
enum AddProperties {
|
||||||
animallist, monsterlist, blockblacklist, playerwhitelist, playerblacklist, editwhitelist, editblacklist, worldblacklist, animals, monsters
|
blockblacklist, playerwhitelist, playerblacklist, worldblacklist, animals, monsters
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Action {
|
enum Action {
|
||||||
Set, Add, Remove, Clear
|
Set, Add, Remove, Clear
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Color == Aliascolor
|
||||||
enum SetProperties {
|
enum SetProperties {
|
||||||
alias, animals, monsters, pvp, scaling
|
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ModifyCommand extends BaseCommand {
|
public class ModifyCommand extends Command {
|
||||||
|
|
||||||
public ModifyCommand(MultiverseCore plugin) {
|
public ModifyCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.name = "Modify a World";
|
this.commandName = "Modify a World";
|
||||||
this.description = "MVModify requires an extra parameter: SET,ADD,REMOVE or CLEAR. See below for usage.";
|
this.commandDesc = "MVModify requires an extra parameter: SET,ADD,REMOVE or CLEAR. See below for usage.";
|
||||||
this.usage = "/mvmodify" + ChatColor.GREEN + " {SET|ADD|REMOVE|CLEAR} ...";
|
this.commandUsage = "/mvmodify" + ChatColor.GREEN + " {SET|ADD|REMOVE|CLEAR} ...";
|
||||||
this.minArgs = 0;
|
// Make it so they can NEVER execute this one
|
||||||
this.maxArgs = 0;
|
this.minimumArgLength = 1;
|
||||||
this.identifiers.add("mvmodify");
|
this.maximumArgLength = 0;
|
||||||
|
this.commandKeys.add("mvmodify");
|
||||||
|
this.commandKeys.add("mvm");
|
||||||
this.permission = "multiverse.world.modify";
|
this.permission = "multiverse.world.modify";
|
||||||
this.requiresOp = true;
|
this.opRequired = true;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
|
||||||
sender.sendMessage(this.name);
|
|
||||||
sender.sendMessage(this.description);
|
|
||||||
sender.sendMessage(this.usage);
|
|
||||||
// This is just a place holder. The real commands are in:
|
|
||||||
// ModifyAddCommand
|
|
||||||
// ModifyRemoveCommand
|
|
||||||
// ModifySetCommand
|
|
||||||
// ModifyClearCommand
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean validateAction(Action action, String property) {
|
protected static boolean validateAction(Action action, String property) {
|
||||||
if (action == Action.Set) {
|
if (action == Action.Set) {
|
||||||
try {
|
try {
|
||||||
@ -59,6 +53,15 @@ public class ModifyCommand extends BaseCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
// This is just a place holder. The real commands are in:
|
||||||
|
// ModifyAddCommand
|
||||||
|
// ModifyRemoveCommand
|
||||||
|
// ModifySetCommand
|
||||||
|
// ModifyClearCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class ModifyRemoveCommand extends Command {
|
||||||
|
|
||||||
|
public ModifyRemoveCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Modify a World";
|
||||||
|
this.commandDesc = "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used";
|
||||||
|
this.commandUsage = "/mvmodify" + ChatColor.GREEN + "REMOVE {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]";
|
||||||
|
this.minimumArgLength = 2;
|
||||||
|
this.maximumArgLength = 3;
|
||||||
|
this.commandKeys.add("mvmodify remove");
|
||||||
|
this.commandKeys.add("mv modify remove");
|
||||||
|
this.commandKeys.add("mvm remove");
|
||||||
|
this.commandKeys.add("mvmremove");
|
||||||
|
this.permission = "multiverse.world.modify";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
// We NEED a world from the command line
|
||||||
|
Player p = null;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
p = (Player) sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 2 && p == null) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "From the console, WORLD is required.");
|
||||||
|
sender.sendMessage(this.commandDesc);
|
||||||
|
sender.sendMessage(this.commandUsage);
|
||||||
|
sender.sendMessage("Nothing changed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MVWorld world;
|
||||||
|
String value = args.get(0);
|
||||||
|
String property = args.get(1);
|
||||||
|
|
||||||
|
if (args.size() == 2) {
|
||||||
|
world = ((MultiverseCore) this.plugin).getMVWorld(p.getWorld().getName());
|
||||||
|
} else {
|
||||||
|
world = ((MultiverseCore) this.plugin).getMVWorld(args.get(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (world == null) {
|
||||||
|
sender.sendMessage("That world does not exist!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ModifyCommand.validateAction(Action.Remove, property)) {
|
||||||
|
sender.sendMessage("Sorry, you can't REMOVE anything from" + property);
|
||||||
|
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/4W8cY");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (world.removeFromList(property, value)) {
|
||||||
|
sender.sendMessage(value + " was removed from " + property);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(value + " could not be removed from " + property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class ModifySetCommand extends Command {
|
||||||
|
|
||||||
|
public ModifySetCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Modify a World (Set a value)";
|
||||||
|
this.commandDesc = "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used";
|
||||||
|
this.commandUsage = "/mvmodify" + ChatColor.GREEN + " set {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]";
|
||||||
|
this.minimumArgLength = 2;
|
||||||
|
this.maximumArgLength = 3;
|
||||||
|
this.commandKeys.add("mvmodify set");
|
||||||
|
this.commandKeys.add("mv modify set");
|
||||||
|
this.commandKeys.add("mvm set");
|
||||||
|
this.commandKeys.add("mvmset");
|
||||||
|
this.permission = "multiverse.world.modify";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
// We NEED a world from the command line
|
||||||
|
Player p = null;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
p = (Player) sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 2 && p == null) {
|
||||||
|
sender.sendMessage("From the command line, WORLD is required.");
|
||||||
|
sender.sendMessage(this.commandDesc);
|
||||||
|
sender.sendMessage(this.commandUsage);
|
||||||
|
sender.sendMessage("Nothing changed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MVWorld world;
|
||||||
|
String value = args.get(1);
|
||||||
|
String property = args.get(0);
|
||||||
|
|
||||||
|
if (args.size() == 2) {
|
||||||
|
world = ((MultiverseCore) this.plugin).getMVWorld(p.getWorld().getName());
|
||||||
|
} else {
|
||||||
|
world = ((MultiverseCore) this.plugin).getMVWorld(args.get(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (world == null) {
|
||||||
|
sender.sendMessage("That world does not exist!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ModifyCommand.validateAction(Action.Set, property)) {
|
||||||
|
sender.sendMessage("Sorry, you can't SET " + property);
|
||||||
|
sender.sendMessage("Please visit our Github Wiki for more information: http://goo.gl/l54PH");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !world.isValidAliasColor(value)) {
|
||||||
|
sender.sendMessage(value + " is not a valid color. Please see our Github Wiki for the complete color list.");
|
||||||
|
} else if (world.setVariable(property, value)) {
|
||||||
|
sender.sendMessage("Property " + property + " was set to " + value);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("There was an error setting " + property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.onarandombox.utils.PurgeWorlds;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class PurgeCommand extends Command {
|
||||||
|
|
||||||
|
public PurgeCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Purge the world ";
|
||||||
|
this.commandDesc = "Removed the specified type of mob from the specified world.";
|
||||||
|
this.commandUsage = "/mvpurge" + ChatColor.GOLD + " [WORLD|all] " + ChatColor.GREEN + "{all|animals|monsters|MOBNAME}";
|
||||||
|
this.minimumArgLength = 1;
|
||||||
|
this.maximumArgLength = 2;
|
||||||
|
this.commandKeys.add("mvpurge");
|
||||||
|
this.commandKeys.add("mv purge");
|
||||||
|
this.permission = "multiverse.world.purge";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
Player p = null;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
p = (Player) sender;
|
||||||
|
}
|
||||||
|
if (args.size() == 1 && p == null) {
|
||||||
|
sender.sendMessage("This command requires a WORLD when being run from the console!");
|
||||||
|
sender.sendMessage(this.commandUsage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String worldName = null;
|
||||||
|
String deathName = null;
|
||||||
|
if (args.size() == 1) {
|
||||||
|
worldName = p.getWorld().getName();
|
||||||
|
deathName = args.get(0);
|
||||||
|
} else {
|
||||||
|
worldName = args.get(0);
|
||||||
|
deathName = args.get(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!worldName.equalsIgnoreCase("all") && !((MultiverseCore) this.plugin).isMVWorld(worldName)) {
|
||||||
|
sender.sendMessage("Multiverse doesn't know about " + worldName);
|
||||||
|
sender.sendMessage("... so It cannot be purged");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MVWorld> worldsToRemoveEntitiesFrom = new ArrayList<MVWorld>();
|
||||||
|
// Handle all case any user who names a world "all" should know better...
|
||||||
|
if (worldName.equalsIgnoreCase("all")) {
|
||||||
|
worldsToRemoveEntitiesFrom.addAll(((MultiverseCore) this.plugin).getMVWorlds());
|
||||||
|
} else {
|
||||||
|
worldsToRemoveEntitiesFrom.add(((MultiverseCore) this.plugin).getMVWorld(worldName));
|
||||||
|
}
|
||||||
|
|
||||||
|
PurgeWorlds purger = ((MultiverseCore) this.plugin).getWorldPurger();
|
||||||
|
ArrayList<String> thingsToKill = new ArrayList<String>();
|
||||||
|
if (deathName.equalsIgnoreCase("all") || deathName.equalsIgnoreCase("animals") || deathName.equalsIgnoreCase("monsters")) {
|
||||||
|
thingsToKill.add(deathName.toUpperCase());
|
||||||
|
} else {
|
||||||
|
Collections.addAll(thingsToKill, deathName.toUpperCase().split(","));
|
||||||
|
}
|
||||||
|
for (MVWorld w : worldsToRemoveEntitiesFrom) {
|
||||||
|
purger.purgeWorld(sender, w, thingsToKill, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class ReloadCommand extends Command {
|
||||||
|
|
||||||
|
public ReloadCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Reload";
|
||||||
|
this.commandDesc = "Reloads worlds.yml and config.yml";
|
||||||
|
this.commandUsage = "/mvreload";
|
||||||
|
this.minimumArgLength = 0;
|
||||||
|
this.maximumArgLength = 0;
|
||||||
|
this.commandKeys.add("mvreload");
|
||||||
|
this.commandKeys.add("mv reload");
|
||||||
|
this.commandKeys.add("mvr");
|
||||||
|
this.permission = "multiverse.reload";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
((MultiverseCore) this.plugin).log(Level.INFO, "Reloading Multiverse-Core config.yml and worlds.yml");
|
||||||
|
((MultiverseCore) this.plugin).loadConfigs();
|
||||||
|
((MultiverseCore) this.plugin).loadWorlds(true);
|
||||||
|
((MultiverseCore) this.plugin).log(Level.INFO, "Reload Complete!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class RemoveCommand extends Command {
|
||||||
|
|
||||||
|
public RemoveCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Remove World";
|
||||||
|
this.commandDesc = "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder.";
|
||||||
|
this.commandUsage = "/mvremove " + ChatColor.GREEN + " {WORLD} ";
|
||||||
|
this.minimumArgLength = 1;
|
||||||
|
this.maximumArgLength = 1;
|
||||||
|
this.commandKeys.add("mvremove");
|
||||||
|
this.commandKeys.add("mv remove");
|
||||||
|
this.permission = "multiverse.world.remove";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
if (((MultiverseCore) this.plugin).removeWorld(args.get(0))) {
|
||||||
|
sender.sendMessage("World removed from config!");
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("Error trying to remove world from config!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class SetSpawnCommand extends Command {
|
||||||
|
|
||||||
|
public SetSpawnCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Set World Spawn";
|
||||||
|
this.commandDesc = "Sets the spawn for the current world.";
|
||||||
|
this.commandUsage = "/mvsetspawn";
|
||||||
|
this.minimumArgLength = 0;
|
||||||
|
this.maximumArgLength = 0;
|
||||||
|
this.commandKeys.add("mvsetspawn");
|
||||||
|
this.commandKeys.add("mvss");
|
||||||
|
this.commandKeys.add("mv set spawn");
|
||||||
|
this.permission = "multiverse.world.spawn.set";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
Player p = (Player) sender;
|
||||||
|
Location l = p.getLocation();
|
||||||
|
World w = p.getWorld();
|
||||||
|
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
|
||||||
|
p.sendMessage(w.getName() + " - Spawn set to X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ());
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("You cannot use this command from the console.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MVPlayerSession;
|
||||||
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class SleepCommand extends Command {
|
||||||
|
|
||||||
|
public SleepCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Go To Sleep";
|
||||||
|
this.commandDesc = "Takes you the latest bed you've slept in.";
|
||||||
|
this.commandUsage = "/mv sleep";
|
||||||
|
this.minimumArgLength = 0;
|
||||||
|
this.maximumArgLength = 0;
|
||||||
|
this.commandKeys.add("mv sleep");
|
||||||
|
this.permission = "multiverse.sleep";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
Player p = null;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
p = (Player) sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MVPlayerSession session = ((MultiverseCore) this.plugin).getPlayerSession(p);
|
||||||
|
if (session.getBedRespawnLocation() != null) {
|
||||||
|
p.teleport(session.getBedRespawnLocation());
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("Hmm this is awkward...");
|
||||||
|
sender.sendMessage("Something is wrong with your bed.");
|
||||||
|
sender.sendMessage("It has either been destroyed or obstructed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class SpawnCommand extends Command {
|
||||||
|
|
||||||
|
public SpawnCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Spawn";
|
||||||
|
this.commandDesc = "Transports the player to the that player's current world Spawn Point.";
|
||||||
|
this.commandUsage = "/mvspawn" + ChatColor.GOLD + " [PLAYER]";
|
||||||
|
this.minimumArgLength = 0;
|
||||||
|
this.maximumArgLength = 1;
|
||||||
|
this.commandKeys.add("mvspawn");
|
||||||
|
this.commandKeys.add("mv spawn");
|
||||||
|
this.commandKeys.add("mvs");
|
||||||
|
this.permission = "multiverse.world.spawn";
|
||||||
|
this.opRequired = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
Player player = null;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
player = (Player) sender;
|
||||||
|
}
|
||||||
|
// If a persons name was passed in, you must be A. the console, or B have permissions
|
||||||
|
if (args.size() == 1) {
|
||||||
|
if (player != null && !((MultiverseCore) this.plugin).getPermissions().hasPermission(player, "multiverse.world.spawn.other", true)) {
|
||||||
|
sender.sendMessage("You don't have permission to teleport another player to spawn. (multiverse.world.spawn.other)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player target = this.plugin.getServer().getPlayer(args.get(0));
|
||||||
|
if (target != null) {
|
||||||
|
target.sendMessage("Teleporting to this world's spawn...");
|
||||||
|
target.teleport(target.getWorld().getSpawnLocation());
|
||||||
|
if (player != null) {
|
||||||
|
target.sendMessage("You were teleported by: " + ChatColor.YELLOW + player.getName());
|
||||||
|
} else {
|
||||||
|
target.sendMessage("You were teleported by: " + ChatColor.LIGHT_PURPLE + "the console");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(args.get(0) + " is not logged on right now!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (player != null && !((MultiverseCore) this.plugin).getPermissions().hasPermission(player, "multiverse.world.spawn.self", true)) {
|
||||||
|
sender.sendMessage("You don't have permission to teleport yourself to spawn. (multiverse.world.spawn.self)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (player != null) {
|
||||||
|
player.sendMessage("Teleporting to this world's spawn...");
|
||||||
|
player.teleport(player.getWorld().getSpawnLocation());
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("From the console, you must provide a PLAYER.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,7 @@
|
|||||||
package com.onarandombox.MultiverseCore.command.commands;
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -6,53 +9,59 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MVTeleport;
|
import com.onarandombox.MultiverseCore.MVTeleport;
|
||||||
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
|
||||||
import com.onarandombox.utils.Destination;
|
import com.onarandombox.utils.Destination;
|
||||||
import com.onarandombox.utils.DestinationType;
|
import com.onarandombox.utils.DestinationType;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
public class TeleportCommand extends BaseCommand {
|
public class TeleportCommand extends Command {
|
||||||
private MVTeleport playerTeleporter;
|
private MVTeleport playerTeleporter;
|
||||||
|
|
||||||
public TeleportCommand(MultiverseCore plugin) {
|
public TeleportCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.name = "Teleport";
|
this.commandName = "Teleport";
|
||||||
this.description = "Teleports you to a different world.";
|
this.commandDesc = "Teleports you to a different world.";
|
||||||
this.usage = "/mvtp" + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}";
|
this.commandUsage = "/mvtp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}";
|
||||||
this.minArgs = 1;
|
this.minimumArgLength = 1;
|
||||||
this.maxArgs = 2;
|
this.maximumArgLength = 2;
|
||||||
this.identifiers.add("mvtp");
|
this.commandKeys.add("mvtp");
|
||||||
|
this.commandKeys.add("mv tp");
|
||||||
this.playerTeleporter = new MVTeleport(plugin);
|
this.playerTeleporter = new MVTeleport(plugin);
|
||||||
this.permission = "multiverse.world.tp.self";
|
this.permission = "multiverse.world.tp";
|
||||||
this.requiresOp = true;
|
this.opRequired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
// Check if the command was sent from a Player.
|
// Check if the command was sent from a Player.
|
||||||
Player teleporter = null;
|
Player teleporter = null;
|
||||||
Player teleportee = null;
|
Player teleportee = null;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
teleporter = (Player) sender;
|
teleporter = (Player) sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
String worldName;
|
String worldName;
|
||||||
|
|
||||||
if (args.length == 2) {
|
if (args.size() == 2) {
|
||||||
if (teleporter != null && !this.plugin.ph.hasPermission(sender, "multiverse.world.tp.other", true)) {
|
if (teleporter != null && !((MultiverseCore) this.plugin).getPermissions().hasPermission(sender, "multiverse.world.tp.other", true)) {
|
||||||
sender.sendMessage("You don't have permission to teleport another player.");
|
sender.sendMessage("You don't have permission to teleport another player. (multiverse.world.tp.other)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
teleportee = this.plugin.getServer().getPlayer(args[0]);
|
teleportee = this.plugin.getServer().getPlayer(args.get(0));
|
||||||
if (teleportee == null) {
|
if (teleportee == null) {
|
||||||
sender.sendMessage("Sorry, I couldn't find player: " + args[0]);
|
sender.sendMessage("Sorry, I couldn't find player: " + args.get(0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
worldName = args[1];
|
worldName = args.get(1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
worldName = args[0];
|
worldName = args.get(0);
|
||||||
|
if (teleporter != null && !((MultiverseCore) this.plugin).getPermissions().hasPermission(sender, "multiverse.world.tp.self", true)) {
|
||||||
|
sender.sendMessage("You don't have permission to teleport yourself between worlds. (multiverse.world.tp.self)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage("You can only teleport other players from the command line.");
|
sender.sendMessage("You can only teleport other players from the command line.");
|
||||||
return;
|
return;
|
||||||
@ -60,21 +69,22 @@ public class TeleportCommand extends BaseCommand {
|
|||||||
teleporter = (Player) sender;
|
teleporter = (Player) sender;
|
||||||
teleportee = (Player) sender;
|
teleportee = (Player) sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
Destination d = Destination.parseDestination(worldName, this.plugin);
|
Destination d = Destination.parseDestination(worldName, (MultiverseCore) this.plugin);
|
||||||
if (!(d.getType() == DestinationType.World)) {
|
if (!(d.getType() == DestinationType.World) || !((MultiverseCore) this.plugin).isMVWorld(d.getName())) {
|
||||||
sender.sendMessage("Multiverse does not know about this world: " + worldName);
|
sender.sendMessage("Multiverse does not know about this world: " + worldName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
MVWorld world = ((MultiverseCore) this.plugin).getMVWorld(d.getName());
|
||||||
if (teleporter != null && !this.plugin.ph.canEnterWorld(teleporter, this.plugin.getServer().getWorld(d.getName()))) {
|
|
||||||
|
if (teleporter != null && !((MultiverseCore) this.plugin).getPermissions().canEnterWorld(teleporter, world)) {
|
||||||
if (teleportee.equals(teleporter)) {
|
if (teleportee.equals(teleporter)) {
|
||||||
teleporter.sendMessage("Doesn't look like you're allowed to go " + ChatColor.RED + "there...");
|
teleporter.sendMessage("Doesn't look like you're allowed to go " + ChatColor.RED + "there...");
|
||||||
} else {
|
} else {
|
||||||
teleporter.sendMessage("Doesn't look like you're allowed to send " + ChatColor.GOLD + teleportee.getName() + ChatColor.WHITE + " to " + ChatColor.RED + "there...");
|
teleporter.sendMessage("Doesn't look like you're allowed to send " + ChatColor.GOLD + teleportee.getName() + ChatColor.WHITE + " to " + ChatColor.RED + "there...");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (teleporter != null && !this.plugin.ph.canTravelFromWorld(teleporter, this.plugin.getServer().getWorld(d.getName()))) {
|
} else if (teleporter != null && !((MultiverseCore) this.plugin).getPermissions().canTravelFromWorld(teleporter, world)) {
|
||||||
if (teleportee.equals(teleporter)) {
|
if (teleportee.equals(teleporter)) {
|
||||||
teleporter.sendMessage("DOH! Doesn't look like you can get to " + ChatColor.RED + d.getName() + " from " + ChatColor.GREEN + teleporter.getWorld().getName());
|
teleporter.sendMessage("DOH! Doesn't look like you can get to " + ChatColor.RED + d.getName() + " from " + ChatColor.GREEN + teleporter.getWorld().getName());
|
||||||
} else {
|
} else {
|
||||||
@ -82,8 +92,14 @@ public class TeleportCommand extends BaseCommand {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location l = this.playerTeleporter.getSafeDestination(this.plugin.getServer().getWorld(d.getName()).getSpawnLocation());
|
Location l = this.playerTeleporter.getSafeDestination(this.plugin.getServer().getWorld(world.getName()).getSpawnLocation());
|
||||||
|
if(l == null) {
|
||||||
|
l = this.plugin.getServer().getWorld(world.getName()).getSpawnLocation();
|
||||||
|
}
|
||||||
|
if (l == null) {
|
||||||
|
teleporter.sendMessage("Sorry Boss, I tried everything, but just couldn't teleport ya there!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
teleportee.teleport(l);
|
teleportee.teleport(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class UnloadCommand extends Command {
|
||||||
|
|
||||||
|
public UnloadCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Unload World";
|
||||||
|
this.commandDesc = "Unloads a world from Multiverse. This does NOT remove the world folder. This does NOT remove it from the config file.";
|
||||||
|
this.commandUsage = "/mvunload" + ChatColor.GREEN + " {WORLD} ";
|
||||||
|
this.minimumArgLength = 1;
|
||||||
|
this.maximumArgLength = 1;
|
||||||
|
this.commandKeys.add("mvunload");
|
||||||
|
this.commandKeys.add("mv unload");
|
||||||
|
this.permission = "multiverse.world.unload";
|
||||||
|
this.opRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
if (((MultiverseCore) this.plugin).unloadWorld(args.get(0))) {
|
||||||
|
sender.sendMessage("World Unloaded!");
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("Error trying to unload world!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
73
src/com/onarandombox/MultiverseCore/commands/WhoCommand.java
Normal file
73
src/com/onarandombox/MultiverseCore/commands/WhoCommand.java
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.pneumaticraft.commandhandler.Command;
|
||||||
|
|
||||||
|
public class WhoCommand extends Command {
|
||||||
|
|
||||||
|
public WhoCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.commandName = "Who";
|
||||||
|
this.commandDesc = "States who is in what world";
|
||||||
|
this.commandUsage = "/mvwho" + ChatColor.GOLD + " [WORLD]";
|
||||||
|
this.minimumArgLength = 0;
|
||||||
|
this.maximumArgLength = 1;
|
||||||
|
this.commandKeys.add("mvwho");
|
||||||
|
this.permission = "multiverse.world.list.who";
|
||||||
|
this.opRequired = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
// If this command was sent from a Player then we need to check Permissions
|
||||||
|
Player p = null;
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
p = (Player) sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MVWorld> worlds = new ArrayList<MVWorld>();
|
||||||
|
|
||||||
|
if (args.size() > 0) {
|
||||||
|
if (((MultiverseCore) this.plugin).isMVWorld(args.get(0))) {
|
||||||
|
worlds.add(((MultiverseCore) this.plugin).getMVWorld(args.get(0)));
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "World does not exist");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
worlds = new ArrayList<MVWorld>(((MultiverseCore) this.plugin).getMVWorlds());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (MVWorld world : worlds) {
|
||||||
|
if (!(((MultiverseCore) this.plugin).isMVWorld(world.getName()))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p != null && (!((MultiverseCore) this.plugin).getPermissions().canEnterWorld(p, world))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
List<Player> players = world.getCBWorld().getPlayers();
|
||||||
|
|
||||||
|
String result = "";
|
||||||
|
if (players.size() <= 0) {
|
||||||
|
result = "Empty";
|
||||||
|
} else {
|
||||||
|
for (Player player : players) {
|
||||||
|
result += player.getName() + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(world.getColoredWorldString() + ChatColor.WHITE + " - " + result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,16 +4,23 @@ import java.io.File;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MVConfigMigrator;
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* https://github.com/Nijikokun/iConomy3/blob/master/com/nijiko/coelho/iConomy/iConomy.java
|
* https://github.com/Nijikokun/iConomy3/blob/master/com/nijiko/coelho/iConomy/iConomy.java
|
||||||
|
*
|
||||||
* @author Nijikokun & Coelho
|
* @author Nijikokun & Coelho
|
||||||
*/
|
*/
|
||||||
public class DefaultConfiguration {
|
public class DefaultConfiguration {
|
||||||
|
|
||||||
public DefaultConfiguration(File folder, String name) {
|
public DefaultConfiguration(File folder, String name, MVConfigMigrator migrator) {
|
||||||
File actual = new File(folder, name);
|
File actual = new File(folder, name);
|
||||||
|
// If defaults have been created, and we're being called again, we should try to migrate
|
||||||
|
if (MultiverseCore.defaultConfigsCreated) {
|
||||||
|
migrator.migrate(name, folder);
|
||||||
|
} else if (!actual.exists() && !migrator.migrate(name, folder)) {
|
||||||
|
|
||||||
if (!actual.exists()) {
|
|
||||||
InputStream input = this.getClass().getResourceAsStream("/defaults/" + name);
|
InputStream input = this.getClass().getResourceAsStream("/defaults/" + name);
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
FileOutputStream output = null;
|
FileOutputStream output = null;
|
||||||
@ -47,5 +54,4 @@ public class DefaultConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,32 +4,32 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
public class MVRespawnEvent extends Event{
|
public class MVRespawnEvent extends Event {
|
||||||
private static final long serialVersionUID = -2991894063331856687L;
|
private static final long serialVersionUID = -2991894063331856687L;
|
||||||
private Player player;
|
private Player player;
|
||||||
private Location location;
|
private Location location;
|
||||||
private String respawnMethod;
|
private String respawnMethod;
|
||||||
|
|
||||||
|
|
||||||
public MVRespawnEvent(Location spawningAt, Player p, String respawnMethod) {
|
public MVRespawnEvent(Location spawningAt, Player p, String respawnMethod) {
|
||||||
super("MVRespawn");
|
super("MVRespawn");
|
||||||
this.player = p;
|
this.player = p;
|
||||||
this.location = spawningAt;
|
this.location = spawningAt;
|
||||||
this.respawnMethod = respawnMethod;
|
this.respawnMethod = respawnMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRespawnMethod() {
|
public String getRespawnMethod() {
|
||||||
return this.respawnMethod;
|
return this.respawnMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getPlayersRespawnLocation() {
|
public Location getPlayersRespawnLocation() {
|
||||||
return this.location;
|
return this.location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRespawnLocation(Location l) {
|
public void setRespawnLocation(Location l) {
|
||||||
this.location = l;
|
this.location = l;
|
||||||
}
|
}
|
||||||
|
@ -1,51 +1,80 @@
|
|||||||
package com.onarandombox.utils;
|
package com.onarandombox.utils;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
public class BlockSafety {
|
public class BlockSafety {
|
||||||
/**
|
/**
|
||||||
* This function checks whether the block at the given coordinates are above air or not.
|
* This function checks whether the block at the given coordinates are above air or not.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
* @param z
|
* @param z
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean blockIsAboveAir(World world, double x, double y, double z) {
|
private boolean blockIsAboveAir(Location l) {
|
||||||
return (world.getBlockAt((int) Math.floor(x), (int) Math.floor(y - 1), (int) Math.floor(z)).getType() == Material.AIR);
|
Location downOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
|
||||||
|
downOne.setY(downOne.getY() - 1);
|
||||||
|
return (downOne.getBlock().getType() == Material.AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This function checks whether the block at the coordinates given is safe or not by checking for Laval/Fire/Air etc.
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean blockIsNotSafe(World world, double x, double y, double z) {
|
public boolean blockIsNotSafe(World world, double x, double y, double z) {
|
||||||
if (world.getBlockAt((int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z)).getType() != Material.AIR || world.getBlockAt((int) Math.floor(x), (int) Math.floor(y + 1), (int) Math.floor(z)).getType() != Material.AIR)
|
Location l = new Location(world, x, y, z);
|
||||||
return true;
|
return !playerCanSpawnHereSafely(l);
|
||||||
|
|
||||||
if ((world.getBlockAt((int) Math.floor(x), (int) Math.floor(y - 1), (int) Math.floor(z)).getType() == Material.LAVA))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if ((world.getBlockAt((int) Math.floor(x), (int) Math.floor(y - 1), (int) Math.floor(z)).getType() == Material.STATIONARY_LAVA))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if ((world.getBlockAt((int) Math.floor(x), (int) Math.floor(y - 1), (int) Math.floor(z)).getType() == Material.FIRE))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if ((world.getBlockAt((int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z)).getType() == Material.FIRE))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (blockIsAboveAir(world, x, y, z))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function checks whether the block at the coordinates given is safe or not by checking for Laval/Fire/Air etc. This also ensures there is enough space for a player to spawn!
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* @param x
|
||||||
|
* @param y
|
||||||
|
* @param z
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean playerCanSpawnHereSafely(Location l) {
|
||||||
|
Location actual = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
|
||||||
|
Location upOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
|
||||||
|
Location downOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
|
||||||
|
upOne.setY(upOne.getY() + 1);
|
||||||
|
downOne.setY(downOne.getY() - 1);
|
||||||
|
|
||||||
|
if (actual.getBlock().getType() != Material.AIR || upOne.getBlock().getType() != Material.AIR)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (downOne.getBlock().getType() == Material.LAVA)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (downOne.getBlock().getType() == Material.STATIONARY_LAVA)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (downOne.getBlock().getType() == Material.FIRE)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (actual.getBlock().getType() == Material.FIRE)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (blockIsAboveAir(actual))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showDangers(Location l) {
|
||||||
|
Location actual = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
|
||||||
|
Location upOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
|
||||||
|
Location downOne = new Location(l.getWorld(), l.getX(), l.getY(), l.getZ());
|
||||||
|
upOne.setY(upOne.getY() + 1);
|
||||||
|
downOne.setY(downOne.getY() - 1);
|
||||||
|
|
||||||
|
System.out.print("Location Up: " + upOne.getBlock().getType());
|
||||||
|
System.out.print(" " + upOne);
|
||||||
|
System.out.print("Location: " + actual.getBlock().getType());
|
||||||
|
System.out.print(" " + actual);
|
||||||
|
System.out.print("Location Down: " + downOne.getBlock().getType());
|
||||||
|
System.out.print(" " + downOne);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package com.onarandombox.utils;
|
package com.onarandombox.utils;
|
||||||
|
|
||||||
public class CommandCatcher extends Thread {
|
public class CommandCatcher extends Thread {
|
||||||
|
|
||||||
}
|
}
|
@ -15,10 +15,12 @@ public class DebugLog {
|
|||||||
|
|
||||||
private FileHandler fh;
|
private FileHandler fh;
|
||||||
private Logger log;
|
private Logger log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new debug logger.
|
* Creates a new debug logger.
|
||||||
|
*
|
||||||
* @param logger The name of the logger.
|
* @param logger The name of the logger.
|
||||||
* @param file The file to log to.
|
* @param file The file to log to.
|
||||||
*/
|
*/
|
||||||
public DebugLog(String logger, String file) {
|
public DebugLog(String logger, String file) {
|
||||||
this.log = Logger.getLogger(logger);
|
this.log = Logger.getLogger(logger);
|
||||||
@ -38,8 +40,10 @@ public class DebugLog {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a message at a certain level
|
* Log a message at a certain level
|
||||||
|
*
|
||||||
* @param level
|
* @param level
|
||||||
* @param msg
|
* @param msg
|
||||||
*/
|
*/
|
||||||
|
@ -5,26 +5,43 @@ import com.onarandombox.MultiverseCore.MultiverseCore;
|
|||||||
public class Destination {
|
public class Destination {
|
||||||
private String name;
|
private String name;
|
||||||
private DestinationType type;
|
private DestinationType type;
|
||||||
|
|
||||||
public Destination(String name, DestinationType type) {
|
public Destination(String name, DestinationType type) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
|
if(name.split(":").length > 1) {
|
||||||
|
this.type = DestinationType.Invalid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
if(this.type == DestinationType.Portal) {
|
||||||
|
return "p:" + this.name;
|
||||||
|
} else if(this.type == DestinationType.World) {
|
||||||
|
return "w:" + this.name;
|
||||||
|
}
|
||||||
|
return "i:" + this.name;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DestinationType getType() {
|
public DestinationType getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Destination getBadDestination() {
|
private static Destination getBadDestination() {
|
||||||
return new Destination("", DestinationType.Invalid);
|
return new Destination("", DestinationType.Invalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes the given string and returns a Destination. This will NEVER be NULL. It will return a destination of type Invalid if the destination is bad.
|
* Takes the given string and returns a Destination. This will NEVER be NULL. It will return a destination of type Invalid if the destination is bad.
|
||||||
* @param dest The parceable string, ex: w:My World
|
*
|
||||||
|
* @param dest The parceable string, ex: w:My World
|
||||||
* @param plugin The MultiverseCore plugin used to find valid worlds/portals
|
* @param plugin The MultiverseCore plugin used to find valid worlds/portals
|
||||||
* @return A new Destination from the parsed string.
|
* @return A new Destination from the parsed string.
|
||||||
*/
|
*/
|
||||||
@ -32,17 +49,17 @@ public class Destination {
|
|||||||
if (dest == null) {
|
if (dest == null) {
|
||||||
return getBadDestination();
|
return getBadDestination();
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] items = dest.split(":");
|
String[] items = dest.split(":");
|
||||||
if (items.length > 2) {
|
if (items.length > 2) {
|
||||||
return getBadDestination();
|
return getBadDestination();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we only found one param, assume world, but still check for validity
|
// If we only found one param, assume world, but still check for validity
|
||||||
if (items.length == 1 && plugin.isMVWorld(items[0])) {
|
if (items.length == 1 && plugin.isMVWorld(items[0])) {
|
||||||
return new Destination(items[0], DestinationType.World);
|
return new Destination(items[0], DestinationType.World);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items[0].equalsIgnoreCase("w") && plugin.isMVWorld(items[0])) {
|
if (items[0].equalsIgnoreCase("w") && plugin.isMVWorld(items[0])) {
|
||||||
return new Destination(items[1], DestinationType.World);
|
return new Destination(items[1], DestinationType.World);
|
||||||
} else if (items[0].equalsIgnoreCase("p")) {
|
} else if (items[0].equalsIgnoreCase("p")) {
|
||||||
|
@ -7,6 +7,7 @@ public class LocationManipulation {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a Location into a Colon separated string to allow us to store it in text.
|
* Convert a Location into a Colon separated string to allow us to store it in text.
|
||||||
|
*
|
||||||
* @param location
|
* @param location
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -22,6 +23,7 @@ public class LocationManipulation {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a String to a Location.
|
* Convert a String to a Location.
|
||||||
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param xStr
|
* @param xStr
|
||||||
* @param yStr
|
* @param yStr
|
||||||
@ -42,6 +44,7 @@ public class LocationManipulation {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a Location to XYZ Coordinates.
|
* Convert a Location to XYZ Coordinates.
|
||||||
|
*
|
||||||
* @param l
|
* @param l
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -55,6 +58,7 @@ public class LocationManipulation {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the NESW Direction a Location is facing.
|
* Return the NESW Direction a Location is facing.
|
||||||
|
*
|
||||||
* @param location
|
* @param location
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -14,13 +14,13 @@ import com.onarandombox.MultiverseCore.MVWorld;
|
|||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
|
||||||
public class PurgeWorlds {
|
public class PurgeWorlds {
|
||||||
|
|
||||||
MultiverseCore plugin;
|
MultiverseCore plugin;
|
||||||
|
|
||||||
public PurgeWorlds(MultiverseCore plugin) {
|
public PurgeWorlds(MultiverseCore plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronizes the given world with it's settings
|
* Synchronizes the given world with it's settings
|
||||||
*/
|
*/
|
||||||
@ -32,8 +32,10 @@ public class PurgeWorlds {
|
|||||||
this.purgeWorld(sender, world);
|
this.purgeWorld(sender, world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convince method for clearing all the animals that do not belong according to the config.
|
* Convince method for clearing all the animals that do not belong according to the config.
|
||||||
|
*
|
||||||
* @param sender
|
* @param sender
|
||||||
* @param world
|
* @param world
|
||||||
*/
|
*/
|
||||||
@ -45,17 +47,18 @@ public class PurgeWorlds {
|
|||||||
allMobs.addAll(world.getMonsterList());
|
allMobs.addAll(world.getMonsterList());
|
||||||
purgeWorld(sender, world, allMobs, !world.allowAnimalSpawning(), !world.allowMonsterSpawning());
|
purgeWorld(sender, world, allMobs, !world.allowAnimalSpawning(), !world.allowMonsterSpawning());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void purgeWorld(CommandSender sender, MVWorld mvworld, List<String> thingsToKill, boolean negateAnimals, boolean negateMonsters) {
|
public void purgeWorld(CommandSender sender, MVWorld mvworld, List<String> thingsToKill, boolean negateAnimals, boolean negateMonsters) {
|
||||||
if (mvworld == null)
|
if (mvworld == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
World world = this.plugin.getServer().getWorld(mvworld.getName());
|
World world = this.plugin.getServer().getWorld(mvworld.getName());
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int entitiesKilled = 0;
|
int entitiesKilled = 0;
|
||||||
for (Entity e : world.getEntities()) {
|
for (Entity e : world.getEntities()) {
|
||||||
|
|
||||||
// Check against Monsters
|
// Check against Monsters
|
||||||
if (killMonster(mvworld, e, thingsToKill, negateMonsters)) {
|
if (killMonster(mvworld, e, thingsToKill, negateMonsters)) {
|
||||||
entitiesKilled++;
|
entitiesKilled++;
|
||||||
@ -66,11 +69,13 @@ public class PurgeWorlds {
|
|||||||
entitiesKilled++;
|
entitiesKilled++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (sender != null) {
|
||||||
|
sender.sendMessage(entitiesKilled + " entities purged from the world '" + world.getName() + "'");
|
||||||
}
|
}
|
||||||
this.plugin.log(Level.INFO, "I just murdered " + entitiesKilled + " in " + world.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean killCreature(MVWorld mvworld, Entity e, List<String> creaturesToKill, boolean negate) {
|
private boolean killCreature(MVWorld mvworld, Entity e, List<String> creaturesToKill, boolean negate) {
|
||||||
String entityName = e.toString().replaceAll("Craft", "").toUpperCase();
|
String entityName = e.toString().replaceAll("Craft", "").toUpperCase();
|
||||||
if (e instanceof Squid || e instanceof Animals) {
|
if (e instanceof Squid || e instanceof Animals) {
|
||||||
@ -88,10 +93,10 @@ public class PurgeWorlds {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will kill the monster if it's in the list UNLESS the NEGATE boolean is set, then it will kill it if it's NOT
|
* Will kill the monster if it's in the list UNLESS the NEGATE boolean is set, then it will kill it if it's NOT
|
||||||
*
|
*
|
||||||
* @param mvworld
|
* @param mvworld
|
||||||
* @param e
|
* @param e
|
||||||
* @param creaturesToKill
|
* @param creaturesToKill
|
||||||
@ -115,5 +120,5 @@ public class PurgeWorlds {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,7 @@ public class UpdateChecker {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the given Version String to a Normalised Version String so we can compare it.
|
* Convert the given Version String to a Normalised Version String so we can compare it.
|
||||||
|
*
|
||||||
* @param version
|
* @param version
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -1,27 +1,10 @@
|
|||||||
# !!!This only applies to worlds being handled by Multiverse!!!
|
# !!!This only applies to worlds being handled by Multiverse!!!
|
||||||
# If you don't see it using /mvlist this setting WILL HAVE NO EFFECT
|
# If you don't see it using /mvlist this setting WILL HAVE NO EFFECT
|
||||||
# Valid values are:
|
|
||||||
# all: If you die in a Nether an attempt will be made to spawn you in the corresponding Normal world, if not you go to defaultspawnworld
|
|
||||||
# default: If you die in a Nether you will respawn in the world defined below in defaultspawnworld
|
|
||||||
# none: You will always respawn in the same world you died in
|
|
||||||
notchrespawnstyle: none
|
|
||||||
|
|
||||||
# Should multivers spawn players at their bed if they've slept there?
|
|
||||||
# This value will OVERRIDE notchrespawnstyle
|
|
||||||
bedrespawn: true
|
|
||||||
|
|
||||||
# Used only in notchrespawnstyle, this is the default world players will spawn in if they die.
|
|
||||||
# If you type some world that does not exist, this will default to your default world.
|
|
||||||
defaultspawnworld: world
|
|
||||||
|
|
||||||
# How long to leave in between sending a message to the player.
|
# How long to leave in between sending a message to the player.
|
||||||
# In Milliseconds - Default is '5000' which is 5 Seconds.
|
# In Milliseconds - Default is '5000' which is 5 Seconds.
|
||||||
messagecooldown: 5000
|
messagecooldown: 5000
|
||||||
|
|
||||||
# Portal Cooldown, only affects MultiVerse portals.
|
|
||||||
# In Milliseconds - Default is '5000' which is 5 Seconds.
|
|
||||||
portalcooldown: 5000
|
|
||||||
|
|
||||||
# If this is set to true, we will prefix the chat with
|
# If this is set to true, we will prefix the chat with
|
||||||
# a colorful world alias if it's present. If not, we simply
|
# a colorful world alias if it's present. If not, we simply
|
||||||
# show the world's name in white. If this is false Multiverse
|
# show the world's name in white. If this is false Multiverse
|
||||||
@ -37,4 +20,16 @@ opfallback: true
|
|||||||
|
|
||||||
# If you have a world(s) that has monsters = false, and you want to disable the built
|
# If you have a world(s) that has monsters = false, and you want to disable the built
|
||||||
# in autohealing, set this to true. This will have NO EFFECT if monsters = true for a given world.
|
# in autohealing, set this to true. This will have NO EFFECT if monsters = true for a given world.
|
||||||
disableautoheal: false
|
disableautoheal: false
|
||||||
|
|
||||||
|
# This will use the old style of PVP prevention so you can have zones of PVP
|
||||||
|
# Players will be notified when they punch/shoot and it's not allowed.
|
||||||
|
fakepvp: false
|
||||||
|
|
||||||
|
# When this is enabled, users will spawn at their last bed slept at. If the bed is destroyed or obstructed,
|
||||||
|
# they will spawn according to how you have 'notchrespawnstyle' set.
|
||||||
|
bedrespawn: true
|
||||||
|
|
||||||
|
# This just signifies the version number so we can see what version of config you have.
|
||||||
|
# NEVER TOUCH THIS VALUE
|
||||||
|
version: 2.0
|
@ -1,7 +1,7 @@
|
|||||||
name: Multiverse-Core
|
name: Multiverse-Core
|
||||||
main: com.onarandombox.MultiverseCore.MultiverseCore
|
main: com.onarandombox.MultiverseCore.MultiverseCore
|
||||||
authors: ['Rigby', 'Herocraft Coding Team']
|
authors: ['Rigby', 'fernferret']
|
||||||
version: 2.0
|
version: 2.0
|
||||||
commands:
|
commands:
|
||||||
mv:
|
mv:
|
||||||
description: Generic Multiverse Command
|
description: Generic Multiverse Command
|
||||||
@ -12,12 +12,24 @@ commands:
|
|||||||
/<command> <world> <environment>
|
/<command> <world> <environment>
|
||||||
/<command> creative normal -- Creates a world called 'creative' with a NORMAL environment.
|
/<command> creative normal -- Creates a world called 'creative' with a NORMAL environment.
|
||||||
/<command> hellworld nether -- Creates a world called 'hellworld' with a NETHER environment.
|
/<command> hellworld nether -- Creates a world called 'hellworld' with a NETHER environment.
|
||||||
|
mvc:
|
||||||
|
description: World create command
|
||||||
|
usage: |
|
||||||
|
/<command> <world> <environment>
|
||||||
|
/<command> creative normal -- Creates a world called 'creative' with a NORMAL environment.
|
||||||
|
/<command> hellworld nether -- Creates a world called 'hellworld' with a NETHER environment.
|
||||||
mvimport:
|
mvimport:
|
||||||
description: World import command
|
description: World import command
|
||||||
usage: |
|
usage: |
|
||||||
/<command> <world> <environment>
|
/<command> <world> <environment>
|
||||||
/<command> creative normal -- Imports an existing world called 'creative' with a NORMAL environment.
|
/<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.
|
/<command> hellworld nether -- Imports an existing world called 'hellworld' with a NETHER environment.
|
||||||
|
mvim:
|
||||||
|
description: World import command
|
||||||
|
usage: |
|
||||||
|
/<command> <world> <environment>
|
||||||
|
/<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:
|
mvremove:
|
||||||
description: World remove command
|
description: World remove command
|
||||||
usage: |
|
usage: |
|
||||||
@ -35,6 +47,31 @@ commands:
|
|||||||
usage: |
|
usage: |
|
||||||
/<command> <world> <option>:<value>
|
/<command> <world> <option>:<value>
|
||||||
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||||
|
mvmset:
|
||||||
|
description: Modify the settings of an existing world
|
||||||
|
usage: |
|
||||||
|
/<command> <world> <option>:<value>
|
||||||
|
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||||
|
mvmadd:
|
||||||
|
description: Modify the settings of an existing world
|
||||||
|
usage: |
|
||||||
|
/<command> <world> <option>:<value>
|
||||||
|
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||||
|
mvmremove:
|
||||||
|
description: Modify the settings of an existing world
|
||||||
|
usage: |
|
||||||
|
/<command> <world> <option>:<value>
|
||||||
|
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||||
|
mvmclear:
|
||||||
|
description: Modify the settings of an existing world
|
||||||
|
usage: |
|
||||||
|
/<command> <world> <option>:<value>
|
||||||
|
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||||
|
mvm:
|
||||||
|
description: Modify the settings of an existing world
|
||||||
|
usage: |
|
||||||
|
/<command> <world> <option>:<value>
|
||||||
|
/<command> creative pvp:false -- Turns off PVP in the 'creative' world.
|
||||||
mvtp:
|
mvtp:
|
||||||
description: Command to teleport between Worlds
|
description: Command to teleport between Worlds
|
||||||
usage: |
|
usage: |
|
||||||
@ -46,18 +83,36 @@ commands:
|
|||||||
usage: |
|
usage: |
|
||||||
/<command> [environment]
|
/<command> [environment]
|
||||||
Example: /<command> NETHER - Shows all NETHER Worlds.
|
Example: /<command> NETHER - Shows all NETHER Worlds.
|
||||||
Example: /<command> NORMAL - Shows all NORMAL Worlds.
|
Example: /<command> NORMAL - Shows all NORMAL Worlds.
|
||||||
|
mvl:
|
||||||
|
description: Print list of loaded Worlds
|
||||||
|
usage: |
|
||||||
|
/<command> [environment]
|
||||||
|
Example: /<command> NETHER - Shows all NETHER Worlds.
|
||||||
|
Example: /<command> NORMAL - Shows all NORMAL Worlds.
|
||||||
mvsetspawn:
|
mvsetspawn:
|
||||||
description: Set the spawn area for a particular world
|
description: Set the spawn area for a particular world
|
||||||
usage: /<command> -- Sets the spawn area of the current world to your location.
|
usage: /<command> -- Sets the spawn area of the current world to your location.
|
||||||
|
mvss:
|
||||||
|
description: Set the spawn area for a particular world
|
||||||
|
usage: /<command> -- Sets the spawn area of the current world to your location.
|
||||||
mvspawn:
|
mvspawn:
|
||||||
description: Teleport to the spawn area
|
description: Teleport to the spawn area
|
||||||
usage: /<command> -- Teleports you to the spawn area of your current world.
|
usage: /<command> -- Teleports you to the spawn area of your current world.
|
||||||
|
mvs:
|
||||||
|
description: Teleport to the spawn area
|
||||||
|
usage: /<command> -- Teleports you to the spawn area of your current world.
|
||||||
mvcoord:
|
mvcoord:
|
||||||
description: Display World, Coordinates, Direction & Compression for a world.
|
description: Display World, Coordinates, Direction & Compression for a world.
|
||||||
usage: |
|
usage: |
|
||||||
/<command> [world]
|
/<command> [world]
|
||||||
/<command> -- Shows the relevant coordinates in your current world.
|
/<command> -- Shows the relevant coordinates in your current world.
|
||||||
|
/<command> creative -- Shows the relevant coordinates if you were in the 'creative' world.
|
||||||
|
mvc:
|
||||||
|
description: Display World, Coordinates, Direction & Compression for a world.
|
||||||
|
usage: |
|
||||||
|
/<command> [world]
|
||||||
|
/<command> -- Shows the relevant coordinates in your current world.
|
||||||
/<command> creative -- Shows the relevant coordinates if you were in the 'creative' world.
|
/<command> creative -- Shows the relevant coordinates if you were in the 'creative' world.
|
||||||
mvwho:
|
mvwho:
|
||||||
description: Display online users per world.
|
description: Display online users per world.
|
||||||
@ -65,9 +120,18 @@ commands:
|
|||||||
/<command> [world]
|
/<command> [world]
|
||||||
/<command> -- Shows who is online in each world.
|
/<command> -- Shows who is online in each world.
|
||||||
/<command> creative -- Shows who is online in the 'creative' world.
|
/<command> creative -- Shows who is online in the 'creative' world.
|
||||||
|
mvw:
|
||||||
|
description: Display online users per world.
|
||||||
|
usage: |
|
||||||
|
/<command> [world]
|
||||||
|
/<command> -- Shows who is online in each world.
|
||||||
|
/<command> creative -- Shows who is online in the 'creative' world.
|
||||||
mvreload:
|
mvreload:
|
||||||
description: Reload Configuration files.
|
description: Reload Configuration files.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
mvr:
|
||||||
|
description: Reload Configuration files.
|
||||||
|
usage: /<command>
|
||||||
mvpurge:
|
mvpurge:
|
||||||
description: Purge the targetted world of creatures.
|
description: Purge the targetted world of creatures.
|
||||||
usage: |
|
usage: |
|
||||||
@ -83,6 +147,10 @@ commands:
|
|||||||
description: Gets world info.
|
description: Gets world info.
|
||||||
usage: |
|
usage: |
|
||||||
/<command> [world]
|
/<command> [world]
|
||||||
|
mvi:
|
||||||
|
description: Gets world info.
|
||||||
|
usage: |
|
||||||
|
/<command> [world]
|
||||||
mvenv:
|
mvenv:
|
||||||
description: Tells the user all possible world types.
|
description: Tells the user all possible world types.
|
||||||
usage: |
|
usage: |
|
||||||
|
Loading…
Reference in New Issue
Block a user