mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-03 23:07:55 +01:00
Merge branch 'master' of github.com:Herocraft/Multiverse-Core
This commit is contained in:
commit
688ea7a1d3
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.List;
|
||||
@ -23,7 +30,7 @@ public class MVPermissions implements PermissionsInterface {
|
||||
|
||||
/**
|
||||
* Constructor FTW
|
||||
*
|
||||
*
|
||||
* @param plugin Pass along the Core Plugin.
|
||||
*/
|
||||
public MVPermissions(MultiverseCore plugin) {
|
||||
@ -38,7 +45,7 @@ public class MVPermissions implements PermissionsInterface {
|
||||
|
||||
/**
|
||||
* Check if a Player can teleport to the Destination world from there current world.
|
||||
*
|
||||
*
|
||||
* @param p
|
||||
* @param w
|
||||
* @return
|
||||
@ -67,7 +74,7 @@ public class MVPermissions implements PermissionsInterface {
|
||||
|
||||
/**
|
||||
* Check if the Player has the permissions to enter this world.
|
||||
*
|
||||
*
|
||||
* @param p
|
||||
* @param w
|
||||
* @return
|
||||
@ -234,7 +241,7 @@ public class MVPermissions implements PermissionsInterface {
|
||||
|
||||
/**
|
||||
* If the given permission was 'multiverse.core.tp.self', this would return 'multiverse.core.tp.*'.
|
||||
*
|
||||
*
|
||||
* @param seperated
|
||||
* @return
|
||||
*/
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.Date;
|
||||
@ -35,7 +42,7 @@ public class MVPlayerSession {
|
||||
|
||||
/**
|
||||
* Grab whether the cooldown on Portal use has expired or not.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean getTeleportable() {
|
||||
@ -49,20 +56,21 @@ public class MVPlayerSession {
|
||||
|
||||
/**
|
||||
* Send a Message to the Player as long as enough time has passed since the last message.
|
||||
*
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public void message(String msg) {
|
||||
Long time = (new Date()).getTime();
|
||||
if ((time - this.messageLast) > this.config.getInt("messagecooldown", 2000)) {
|
||||
this.player.sendMessage(msg);
|
||||
this.messageLast = time;
|
||||
}
|
||||
}
|
||||
|
||||
// See new class MVMessaging
|
||||
// public void message(String msg) {
|
||||
// Long time = (new Date()).getTime();
|
||||
// if ((time - this.messageLast) > this.config.getInt("messagecooldown", 2000)) {
|
||||
// this.player.sendMessage(msg);
|
||||
// this.messageLast = time;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Commented out bed code, i'll get rid of it soon.
|
||||
// --FF
|
||||
|
||||
|
||||
// public void setRespawnLocation(Location location) {
|
||||
// this.bedSpawn = location;
|
||||
// }
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
public interface MVPlugin extends LoggablePlugin {
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.logging.Level;
|
||||
@ -237,12 +244,12 @@ public class MVTeleport {
|
||||
}
|
||||
if (e instanceof Player) {
|
||||
Player p = (Player) e;
|
||||
p.sendMessage("No safe locations found!");
|
||||
this.plugin.getMessaging().sendMessage(p, "No safe locations found!");
|
||||
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
|
||||
}
|
||||
else if (e.getPassenger() instanceof Player) {
|
||||
Player p = (Player) e.getPassenger();
|
||||
p.sendMessage("No safe locations found!");
|
||||
this.plugin.getMessaging().sendMessage(p, "No safe locations found!");
|
||||
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
|
||||
}
|
||||
this.plugin.log(Level.FINE, "Sorry champ, you're basically trying to teleport into a minefield. I should just kill you now.");
|
||||
@ -314,12 +321,12 @@ public class MVTeleport {
|
||||
}
|
||||
if (e instanceof Player) {
|
||||
Player p = (Player) e;
|
||||
p.sendMessage("No safe locations found!");
|
||||
this.plugin.getMessaging().sendMessage(p, "No safe locations found!");
|
||||
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
|
||||
}
|
||||
else if (e.getPassenger() instanceof Player) {
|
||||
Player p = (Player) e.getPassenger();
|
||||
p.sendMessage("No safe locations found!");
|
||||
this.plugin.getMessaging().sendMessage(p, "No safe locations found!");
|
||||
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
|
||||
}
|
||||
this.plugin.log(Level.FINE, "Sorry champ, you're basically trying to teleport into a minefield. I should just kill you now.");
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@ -14,6 +21,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.onarandombox.MultiverseCore.listeners.*;
|
||||
import com.onarandombox.utils.*;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World.Environment;
|
||||
@ -57,15 +65,6 @@ import com.onarandombox.MultiverseCore.commands.WhoCommand;
|
||||
import com.onarandombox.MultiverseCore.configuration.DefaultConfig;
|
||||
import com.onarandombox.MultiverseCore.configuration.MVConfigMigrator;
|
||||
import com.onarandombox.MultiverseCore.configuration.MVCoreConfigMigrator;
|
||||
import com.onarandombox.utils.CannonDestination;
|
||||
import com.onarandombox.utils.DebugLog;
|
||||
import com.onarandombox.utils.DestinationFactory;
|
||||
import com.onarandombox.utils.ExactDestination;
|
||||
import com.onarandombox.utils.PlayerDestination;
|
||||
import com.onarandombox.utils.PurgeWorlds;
|
||||
import com.onarandombox.utils.UpdateChecker;
|
||||
import com.onarandombox.utils.WorldDestination;
|
||||
import com.onarandombox.utils.WorldManager;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
|
||||
public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
@ -109,6 +108,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
private SpoutInterface spoutInterface = null;
|
||||
private double allpayversion = 3;
|
||||
private double chversion = 1;
|
||||
private MVMessaging messaging;
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
@ -230,6 +230,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
pm.registerEvent(Event.Type.PLAYER_QUIT, this.playerListener, Priority.Normal, this); // To remove Player Sessions
|
||||
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); // To prepend the world name
|
||||
pm.registerEvent(Event.Type.PLAYER_PORTAL, this.playerListener, Priority.Monitor, this); // To switch gamemode
|
||||
|
||||
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 fake PVP
|
||||
@ -272,6 +273,13 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
|
||||
// Setup the Debug option, we'll default to false because this option will not be in the default config.
|
||||
GlobalDebug = this.configMV.getInt("debug", 0);
|
||||
GlobalDebug = this.configMV.getInt("debug", 0);
|
||||
this.messaging = new MVMessaging(this);
|
||||
this.messaging.setCooldown(this.configMV.getInt("messagecooldown", 5000));
|
||||
}
|
||||
|
||||
public MVMessaging getMessaging(){
|
||||
return this.messaging;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -401,7 +409,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
|
||||
if (this.isEnabled() == false) {
|
||||
if (!this.isEnabled()) {
|
||||
sender.sendMessage("This plugin is Disabled!");
|
||||
return true;
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
@ -7,7 +14,7 @@ public class SpoutInterface {
|
||||
public SpoutInterface() {
|
||||
this.spoutManager = SpoutManager.getInstance();
|
||||
}
|
||||
|
||||
|
||||
public SpoutManager getManager() {
|
||||
return this.spoutManager;
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
// 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;
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVTeleport;
|
||||
@ -130,7 +137,10 @@ public class TeleportCommand extends MultiverseCommand {
|
||||
}
|
||||
|
||||
private boolean checkSendPermissions(CommandSender teleporter, Player teleportee, MVDestination destination) {
|
||||
if(teleporter.equals(teleportee)) {
|
||||
if (teleporter == null) {
|
||||
return true;
|
||||
}
|
||||
if (teleporter.equals(teleportee)) {
|
||||
if(!this.plugin.getPermissions().hasPermission(teleporter, "multiverse.teleport.self."+destination.getIdentifier(),true)) {
|
||||
teleporter.sendMessage("You don't have permission to teleport yourself to a " + ChatColor.GREEN + destination.getType() + " Destination.");
|
||||
teleporter.sendMessage(ChatColor.RED + " (multiverse.teleport.self."+destination.getIdentifier()+")");
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.configuration;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.configuration;
|
||||
|
||||
import java.io.File;
|
||||
@ -24,7 +31,7 @@ public abstract class MVConfigMigrator {
|
||||
}
|
||||
newConfig.setProperty("worlds." + key + newProperty, list);
|
||||
}
|
||||
|
||||
|
||||
protected final File detectMultiverseFolders(File folder, LoggablePlugin mvPlugin) {
|
||||
File oldFolder = null;
|
||||
mvPlugin.log(Level.INFO, "Starting Multiverse Configuration Migrator(MVCM)!");
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.configuration;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import java.util.List;
|
||||
@ -12,11 +19,11 @@ public class MVConfigMigrateEvent extends Event {
|
||||
super("MVConfigMigrate");
|
||||
this.configsLoaded = configsLoaded;
|
||||
}
|
||||
|
||||
|
||||
public void addConfig(String config) {
|
||||
this.configsLoaded.add(config);
|
||||
}
|
||||
|
||||
|
||||
public List<String> getAllConfigsLoaded() {
|
||||
return this.configsLoaded;
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import java.util.List;
|
||||
@ -12,11 +19,11 @@ public class MVConfigReloadEvent extends Event {
|
||||
super("MVConfigReload");
|
||||
this.configsLoaded = configsLoaded;
|
||||
}
|
||||
|
||||
|
||||
public void addConfig(String config) {
|
||||
this.configsLoaded.add(config);
|
||||
}
|
||||
|
||||
|
||||
public List<String> getAllConfigsLoaded() {
|
||||
return this.configsLoaded;
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -28,7 +35,7 @@ public class MVTeleportEvent extends Event implements Cancellable {
|
||||
|
||||
/**
|
||||
* Returns the player who will be teleported by this event.
|
||||
*
|
||||
*
|
||||
* @return The player who will be teleported by this event.
|
||||
*/
|
||||
public Player getTeleportee() {
|
||||
@ -37,7 +44,7 @@ public class MVTeleportEvent extends Event implements Cancellable {
|
||||
|
||||
/**
|
||||
* Returns the location the player was before the teleport.
|
||||
*
|
||||
*
|
||||
* @return The location the player was before the teleport.
|
||||
*/
|
||||
public Location getFrom() {
|
||||
@ -46,7 +53,7 @@ public class MVTeleportEvent extends Event implements Cancellable {
|
||||
|
||||
/**
|
||||
* Returns the player who requested the Teleport
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public CommandSender getTeleporter() {
|
||||
@ -55,7 +62,7 @@ public class MVTeleportEvent extends Event implements Cancellable {
|
||||
|
||||
/**
|
||||
* Returns the destination that the player will spawn at.
|
||||
*
|
||||
*
|
||||
* @return The destination the player will spawn at.
|
||||
*/
|
||||
public MVDestination getDestination() {
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.listeners;
|
||||
|
||||
import java.util.List;
|
||||
@ -112,7 +119,7 @@ public class MVEntityListener extends EntityListener {
|
||||
CreatureType creature = event.getCreatureType();
|
||||
|
||||
MVWorld mvworld = this.worldManager.getMVWorld(world.getName());
|
||||
|
||||
|
||||
/**
|
||||
* Handle people with non-standard animals: ie a patched craftbukkit.
|
||||
*/
|
||||
@ -120,7 +127,7 @@ public class MVEntityListener extends EntityListener {
|
||||
this.plugin.log(Level.FINER, "Found a null typed creature.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Animal Handling
|
||||
*/
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.listeners;
|
||||
|
||||
import java.util.logging.Level;
|
||||
@ -7,12 +14,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
|
||||
import com.fernferret.allpay.GenericBank;
|
||||
import com.onarandombox.MultiverseCore.MVTeleport;
|
||||
@ -134,44 +136,71 @@ public class MVPlayerListener extends PlayerListener {
|
||||
|
||||
@Override
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
MVWorld fromWorld = this.worldManager.getMVWorld(event.getTo().getWorld().getName());
|
||||
if(event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
MVWorld fromWorld = this.worldManager.getMVWorld(event.getFrom().getWorld().getName());
|
||||
MVWorld toWorld = this.worldManager.getMVWorld(event.getTo().getWorld().getName());
|
||||
event.setCancelled(checkWorldPermissions(fromWorld, toWorld, event.getPlayer()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerPortal(PlayerPortalEvent event) {
|
||||
if(event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
MVWorld fromWorld = this.worldManager.getMVWorld(event.getFrom().getWorld().getName());
|
||||
MVWorld toWorld = this.worldManager.getMVWorld(event.getTo().getWorld().getName());
|
||||
event.setCancelled(checkWorldPermissions(fromWorld, toWorld, event.getPlayer()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if player can go to a world given their current status.
|
||||
*
|
||||
* The return is a little backwards, and will return a value safe for event.setCancelled.
|
||||
*
|
||||
* @param fromWorld
|
||||
* @param toWorld
|
||||
* @param player
|
||||
* @return True if they can't go to the world, False if they can.
|
||||
*/
|
||||
private boolean checkWorldPermissions(MVWorld fromWorld, MVWorld toWorld, Player player) {
|
||||
|
||||
if (toWorld != null) {
|
||||
if (!this.plugin.getPermissions().canEnterWorld(event.getPlayer(), toWorld)) {
|
||||
event.getPlayer().sendMessage("You don't have access to go here...");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
if (!this.plugin.getPermissions().canEnterWorld(player, toWorld)) {
|
||||
player.sendMessage("You don't have access to go here...");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (fromWorld != null) {
|
||||
if (fromWorld.getWorldBlacklist().contains(toWorld.getName())) {
|
||||
event.getPlayer().sendMessage("You don't have access to go to " + toWorld.getColoredWorldString() + " from " + fromWorld.getColoredWorldString());
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
player.sendMessage("You don't have access to go to " + toWorld.getColoredWorldString() + " from " + fromWorld.getColoredWorldString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (toWorld == null) {
|
||||
// The toworld is not handled by MV, we don't care about payments
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
// Only check payments if it's a different world:
|
||||
if (!event.getTo().getWorld().equals(event.getFrom().getWorld())) {
|
||||
if (!toWorld.equals(fromWorld)) {
|
||||
// Handle the Players GameMode setting for the new world.
|
||||
if (this.plugin.getConfig().getBoolean("enforcegamemodes", true)) {
|
||||
this.handleGameMode(event.getPlayer(), toWorld);
|
||||
this.handleGameMode(player, toWorld);
|
||||
}
|
||||
|
||||
// If the player does not have to pay, return now.
|
||||
if (toWorld.isExempt(event.getPlayer())) {
|
||||
return;
|
||||
if (toWorld.isExempt(player)) {
|
||||
return false;
|
||||
}
|
||||
GenericBank bank = plugin.getBank();
|
||||
if (!bank.hasEnough(event.getPlayer(), toWorld.getPrice(), toWorld.getCurrency(), "You need " + bank.getFormattedAmount(event.getPlayer(), toWorld.getPrice(), toWorld.getCurrency()) + " to enter " + toWorld.getColoredWorldString())) {
|
||||
event.setCancelled(true);
|
||||
if (!bank.hasEnough(player, toWorld.getPrice(), toWorld.getCurrency(), "You need " + bank.getFormattedAmount(player, toWorld.getPrice(), toWorld.getCurrency()) + " to enter " + toWorld.getColoredWorldString())) {
|
||||
return true;
|
||||
} else {
|
||||
bank.pay(event.getPlayer(), toWorld.getPrice(), toWorld.getCurrency());
|
||||
bank.pay(player, toWorld.getPrice(), toWorld.getCurrency());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// FOLLOWING 2 Methods and Private class handle Per Player GameModes.
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.listeners;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.listeners;
|
||||
|
||||
import org.bukkit.event.weather.ThunderChangeEvent;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.util.logging.Level;
|
||||
@ -19,7 +26,7 @@ public class BlockSafety {
|
||||
|
||||
/**
|
||||
* This function checks whether the block at the given coordinates are above air or not.
|
||||
*
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
@ -36,7 +43,7 @@ public class BlockSafety {
|
||||
Location l = new Location(world, x, y, z);
|
||||
return !playerCanSpawnHereSafely(l);
|
||||
}
|
||||
|
||||
|
||||
public boolean playerCanSpawnHereSafely(World world, double x, double y, double z) {
|
||||
Location l = new Location(world, x, y, z);
|
||||
return playerCanSpawnHereSafely(l);
|
||||
@ -44,7 +51,7 @@ public class BlockSafety {
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -85,7 +92,7 @@ public class BlockSafety {
|
||||
|
||||
/**
|
||||
* If someone has a better way of this... Please either tell us, or submit a pull request!
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@ -175,7 +182,7 @@ public class BlockSafety {
|
||||
|
||||
/**
|
||||
* Checks recursively below location L for 2 blocks of water
|
||||
*
|
||||
*
|
||||
* @param l
|
||||
* @return
|
||||
*/
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -7,30 +14,30 @@ public class FancyColorScheme {
|
||||
private ChatColor mainColor;
|
||||
private ChatColor altColor;
|
||||
private ChatColor defContentColor;
|
||||
|
||||
|
||||
public FancyColorScheme(ChatColor header, ChatColor main, ChatColor alt, ChatColor defaultColor) {
|
||||
this.headerColor = header;
|
||||
this.mainColor = main;
|
||||
this.altColor = alt;
|
||||
this.defContentColor = defaultColor;
|
||||
}
|
||||
|
||||
|
||||
public ChatColor getHeader() {
|
||||
return this.headerColor;
|
||||
}
|
||||
|
||||
|
||||
public ChatColor getMain() {
|
||||
return this.mainColor;
|
||||
}
|
||||
|
||||
|
||||
public ChatColor getAlt() {
|
||||
return this.altColor;
|
||||
}
|
||||
|
||||
|
||||
public ChatColor getDefault() {
|
||||
return this.defContentColor;
|
||||
}
|
||||
|
||||
|
||||
public ChatColor getMain(boolean main) {
|
||||
return main ? this.getMain() : this.getAlt();
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
public class FancyHeader implements FancyText {
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
public class FancyMessage implements FancyText {
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
public interface FancyText {
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.io.File;
|
||||
@ -5,9 +12,9 @@ import java.io.File;
|
||||
public class FileUtils {
|
||||
/*
|
||||
* Delete a folder Courtesy of: lithium3141
|
||||
*
|
||||
*
|
||||
* @param file The folder to delete
|
||||
*
|
||||
*
|
||||
* @return true if success
|
||||
*/
|
||||
public static boolean deleteFolder(File file) {
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@ -26,7 +33,7 @@ public class LocationManipulation {
|
||||
|
||||
/**
|
||||
* Convert a Location into a Colon separated string to allow us to store it in text.
|
||||
*
|
||||
*
|
||||
* @param location
|
||||
* @return
|
||||
*/
|
||||
@ -42,7 +49,7 @@ public class LocationManipulation {
|
||||
|
||||
/**
|
||||
* Convert a String to a Location.
|
||||
*
|
||||
*
|
||||
* @param world
|
||||
* @param xStr
|
||||
* @param yStr
|
||||
@ -98,7 +105,7 @@ public class LocationManipulation {
|
||||
|
||||
/**
|
||||
* Return the NESW Direction a Location is facing.
|
||||
*
|
||||
*
|
||||
* @param location
|
||||
* @return
|
||||
*/
|
||||
@ -187,7 +194,7 @@ public class LocationManipulation {
|
||||
|
||||
/**
|
||||
* Returns the next Location that an entity is traveling at
|
||||
*
|
||||
*
|
||||
* @param v
|
||||
* @return
|
||||
*/
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
66
src/main/java/com/onarandombox/utils/MVMessaging.java
Normal file
66
src/main/java/com/onarandombox/utils/MVMessaging.java
Normal file
@ -0,0 +1,66 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Multiverse 2
|
||||
*
|
||||
* @author fernferret
|
||||
*/
|
||||
public class MVMessaging {
|
||||
private MultiverseCore plugin;
|
||||
private Map<String, Date> sentList;
|
||||
private int cooldown = 0;
|
||||
|
||||
public MVMessaging(MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
this.sentList = new HashMap<String, Date>();
|
||||
}
|
||||
|
||||
public void setCooldown(int milliseconds) {
|
||||
this.cooldown = milliseconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a message to the specified sender if the cooldown has passed.
|
||||
* @param sender The person/console to send the message to.
|
||||
* @param message The message to send.
|
||||
* @param ignoreCooldown If true this message will always be sent. Useful for things like menus
|
||||
* @return true if the message was sent, false if not.
|
||||
*/
|
||||
public boolean sendMessage(CommandSender sender, String message, boolean ignoreCooldown) {
|
||||
if(!(sender instanceof Player) || ignoreCooldown) {
|
||||
sender.sendMessage(message);
|
||||
return true;
|
||||
}
|
||||
if(!this.sentList.containsKey(sender.getName())) {
|
||||
sender.sendMessage(message);
|
||||
this.sentList.put(sender.getName(), new Date());
|
||||
return true;
|
||||
} else {
|
||||
if(this.sentList.get(sender.getName()).after(new Date((new Date()).getTime() + this.cooldown))){
|
||||
sender.sendMessage(message);
|
||||
this.sentList.put(sender.getName(), new Date());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean sendMessage(CommandSender sender, String message) {
|
||||
return this.sendMessage(sender, message, true);
|
||||
}
|
||||
}
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.utils;
|
||||
|
||||
import java.io.File;
|
||||
|
Loading…
Reference in New Issue
Block a user