Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4e87b13d2 |
No files matched your search
@@ -319,7 +319,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>1.8</version>
|
||||
<version>1.7</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
|
||||
@@ -128,9 +128,9 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
private static final int PROTOCOL = 24;
|
||||
// TODO: Investigate if this one is really needed to be static.
|
||||
// Doubt it. -- FernFerret
|
||||
private static Map<String, String> teleportQueue = new HashMap<String, String>();
|
||||
private static final Map<String, String> teleportQueue = new HashMap<String, String>();
|
||||
|
||||
private AnchorManager anchorManager = new AnchorManager(this);
|
||||
private final AnchorManager anchorManager = new AnchorManager(this);
|
||||
// TODO please let's make this non-static
|
||||
private volatile MultiverseCoreConfiguration config;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
* Creates a clone of a world.
|
||||
*/
|
||||
public class CloneCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public CloneCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.Map;
|
||||
* Allows you to set Global MV Variables.
|
||||
*/
|
||||
public class ConfigCommand extends MultiverseCommand {
|
||||
|
||||
public ConfigCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Configuration");
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
* Returns detailed information on the Players where abouts.
|
||||
*/
|
||||
public class CoordCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public CoordCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
* Creates a new world and loads it.
|
||||
*/
|
||||
public class CreateCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public CreateCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
* Returns detailed information about a world.
|
||||
*/
|
||||
public class InfoCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public InfoCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@@ -115,7 +115,6 @@ public class InfoCommand extends MultiverseCommand {
|
||||
FancyColorScheme colors = new FancyColorScheme(ChatColor.AQUA, ChatColor.AQUA, ChatColor.GOLD, ChatColor.WHITE);
|
||||
message.add(new FancyHeader("General Info", colors));
|
||||
message.add(new FancyMessage("World Name: ", world.getName(), colors));
|
||||
message.add(new FancyMessage("World UID: ", world.getCBWorld().getUID().toString(), colors));
|
||||
message.add(new FancyMessage("World Alias: ", world.getColoredWorldString(), colors));
|
||||
message.add(new FancyMessage("Game Mode: ", world.getGameMode().toString(), colors));
|
||||
message.add(new FancyMessage("Difficulty: ", world.getDifficulty().toString(), colors));
|
||||
@@ -152,7 +151,6 @@ public class InfoCommand extends MultiverseCommand {
|
||||
message = new ArrayList<FancyText>();
|
||||
message.add(new FancyHeader("More World Settings", colors));
|
||||
message.add(new FancyMessage("World Type: ", world.getWorldType().toString(), colors));
|
||||
message.add(new FancyMessage("Generator: ", world.getGenerator(), colors));
|
||||
message.add(new FancyMessage("Structures: ", world.getCBWorld().canGenerateStructures() + "", colors));
|
||||
message.add(new FancyMessage("Weather: ", world.isWeatherEnabled() + "", colors));
|
||||
message.add(new FancyMessage("Players will get hungry: ", world.getHunger() + "", colors));
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
* Used to modify various aspects of worlds.
|
||||
*/
|
||||
public class ModifyAddCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public ModifyAddCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
* Removes all values from a world-property.
|
||||
*/
|
||||
public class ModifyClearCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public ModifyClearCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
* Removes values from a world-property.
|
||||
*/
|
||||
public class ModifyRemoveCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public ModifyRemoveCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
* Used to set world-properties.
|
||||
*/
|
||||
public class ModifySetCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public ModifySetCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
* Removes a type of mob from a world.
|
||||
*/
|
||||
public class PurgeCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public PurgeCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.logging.Level;
|
||||
* Used to teleport players.
|
||||
*/
|
||||
public class TeleportCommand extends MultiverseCommand {
|
||||
private SafeTTeleporter playerTeleporter;
|
||||
private final SafeTTeleporter playerTeleporter;
|
||||
|
||||
public TeleportCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
@@ -23,8 +23,7 @@ import java.util.List;
|
||||
* States who is in what world.
|
||||
*/
|
||||
public class WhoCommand extends MultiverseCommand {
|
||||
|
||||
private MVWorldManager worldManager;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public WhoCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
* Called when the Multiverse-config should be reloaded.
|
||||
*/
|
||||
public class MVConfigReloadEvent extends Event {
|
||||
private List<String> configsLoaded;
|
||||
private final List<String> configsLoaded;
|
||||
|
||||
public MVConfigReloadEvent(List<String> configsLoaded) {
|
||||
this.configsLoaded = configsLoaded;
|
||||
|
||||
@@ -17,8 +17,8 @@ import org.bukkit.event.HandlerList;
|
||||
* This event is thrown when a portal is touched.
|
||||
*/
|
||||
public class MVPlayerTouchedPortalEvent extends Event implements Cancellable {
|
||||
private Player p;
|
||||
private Location l;
|
||||
private final Player p;
|
||||
private final Location l;
|
||||
private boolean isCancelled;
|
||||
private boolean canUse = true;
|
||||
|
||||
|
||||
@@ -16,10 +16,9 @@ import org.bukkit.event.HandlerList;
|
||||
* Called when a player is respawning.
|
||||
*/
|
||||
public class MVRespawnEvent extends Event {
|
||||
private Player player;
|
||||
private final Player player;
|
||||
private final String respawnMethod;
|
||||
private Location location;
|
||||
private String respawnMethod;
|
||||
|
||||
|
||||
public MVRespawnEvent(Location spawningAt, Player p, String respawnMethod) {
|
||||
this.player = p;
|
||||
|
||||
@@ -21,10 +21,10 @@ import org.bukkit.event.HandlerList;
|
||||
* Event that gets called when a player use the /mvtp command.
|
||||
*/
|
||||
public class MVTeleportEvent extends Event implements Cancellable {
|
||||
private Player teleportee;
|
||||
private CommandSender teleporter;
|
||||
private MVDestination dest;
|
||||
private boolean useSafeTeleport;
|
||||
private final Player teleportee;
|
||||
private final CommandSender teleporter;
|
||||
private final MVDestination dest;
|
||||
private final boolean useSafeTeleport;
|
||||
private boolean isCancelled;
|
||||
|
||||
public MVTeleportEvent(MVDestination dest, Player teleportee, CommandSender teleporter, boolean safeTeleport) {
|
||||
|
||||
@@ -24,11 +24,11 @@ import org.bukkit.event.HandlerList;
|
||||
* @param <T> The type of the property that was set.
|
||||
*/
|
||||
public class MVWorldPropertyChangeEvent<T> extends Event implements Cancellable {
|
||||
private MultiverseWorld world;
|
||||
private CommandSender changer;
|
||||
private boolean isCancelled = false;
|
||||
private String name;
|
||||
private final MultiverseWorld world;
|
||||
private final CommandSender changer;
|
||||
private final String name;
|
||||
private T value;
|
||||
private boolean isCancelled = false;
|
||||
|
||||
public MVWorldPropertyChangeEvent(MultiverseWorld world, CommandSender changer, String name, T value) {
|
||||
this.world = world;
|
||||
|
||||
@@ -28,8 +28,8 @@ import java.util.logging.Level;
|
||||
* Multiverse's Entity {@link Listener}.
|
||||
*/
|
||||
public class MVEntityListener implements Listener {
|
||||
private MultiverseCore plugin;
|
||||
private MVWorldManager worldManager;
|
||||
private final MultiverseCore plugin;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public MVEntityListener(MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -136,6 +136,7 @@ public class MVPlayerListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void playerChangedWorld(PlayerChangedWorldEvent event) {
|
||||
// Permissions now determine whether or not to handle a gamemode.
|
||||
this.handleGameModeAndFlight(event.getPlayer(), event.getPlayer().getWorld());
|
||||
playerWorld.put(event.getPlayer().getName(), event.getPlayer().getWorld().getName());
|
||||
}
|
||||
@@ -264,7 +265,6 @@ public class MVPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when a player actually portals via a vanilla style portal.
|
||||
* @param event The Event that was fired.
|
||||
@@ -318,15 +318,19 @@ public class MVPlayerListener implements Listener {
|
||||
}
|
||||
|
||||
private void sendPlayerToDefaultWorld(final Player player) {
|
||||
player.teleport(plugin.getMVWorldManager().getFirstSpawnWorld().getSpawnLocation());
|
||||
// Remove the player 1 tick after the login. I'm sure there's GOT to be a better way to do this...
|
||||
this.plugin.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.teleport(plugin.getMVWorldManager().getFirstSpawnWorld().getSpawnLocation());
|
||||
}
|
||||
}, 1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the gamemode for the specified {@link Player}.
|
||||
* @param player The {@link Player}.
|
||||
* @param world The world the player is in.
|
||||
*/
|
||||
// FOLLOWING 2 Methods and Private class handle Per Player GameModes.
|
||||
private void handleGameModeAndFlight(Player player, World world) {
|
||||
|
||||
MultiverseWorld mvWorld = this.worldManager.getMVWorld(world.getName());
|
||||
if (mvWorld != null) {
|
||||
this.handleGameModeAndFlight(player, mvWorld);
|
||||
@@ -339,34 +343,42 @@ public class MVPlayerListener implements Listener {
|
||||
/**
|
||||
* Handles the gamemode for the specified {@link Player}.
|
||||
* @param player The {@link Player}.
|
||||
* @param world The MVWorld the player is in.
|
||||
* @param world The world the player is in.
|
||||
*/
|
||||
public void handleGameModeAndFlight(final Player player, final MultiverseWorld world) {
|
||||
if (!MVPlayerListener.this.pt.playerCanIgnoreGameModeRestriction(world, player)) {
|
||||
// Check that the player is in the new world and they haven't been teleported elsewhere or the event cancelled.
|
||||
if (player.getWorld() == world.getCBWorld()) {
|
||||
Logging.fine("Handling gamemode for player: %s, Changing to %s", player.getName(), world.getGameMode().toString());
|
||||
Logging.finest("From World: %s", player.getWorld());
|
||||
Logging.finest("To World: %s", world);
|
||||
player.setGameMode(world.getGameMode());
|
||||
// Check if their flight mode should change
|
||||
// TODO need a override permission for this
|
||||
if (player.getAllowFlight() && !world.getAllowFlight() && player.getGameMode() != GameMode.CREATIVE) {
|
||||
player.setAllowFlight(false);
|
||||
if (player.isFlying()) {
|
||||
player.setFlying(false);
|
||||
// We perform this task one tick later to MAKE SURE that the player actually reaches the
|
||||
// destination world, otherwise we'd be changing the player mode if they havent moved anywhere.
|
||||
this.plugin.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!MVPlayerListener.this.pt.playerCanIgnoreGameModeRestriction(world, player)) {
|
||||
// Check that the player is in the new world and they haven't been teleported elsewhere or the event cancelled.
|
||||
if (player.getWorld() == world.getCBWorld()) {
|
||||
Logging.fine("Handling gamemode for player: %s, Changing to %s", player.getName(), world.getGameMode().toString());
|
||||
Logging.finest("From World: %s", player.getWorld());
|
||||
Logging.finest("To World: %s", world);
|
||||
player.setGameMode(world.getGameMode());
|
||||
// Check if their flight mode should change
|
||||
// TODO need a override permission for this
|
||||
if (player.getAllowFlight() && !world.getAllowFlight() && player.getGameMode() != GameMode.CREATIVE) {
|
||||
player.setAllowFlight(false);
|
||||
if (player.isFlying()) {
|
||||
player.setFlying(false);
|
||||
}
|
||||
} else if (world.getAllowFlight()) {
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
player.setAllowFlight(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logging.fine("The gamemode/allowfly was NOT changed for player '%s' because he is now in world '%s' instead of world '%s'",
|
||||
player.getName(), player.getWorld().getName(), world.getName());
|
||||
}
|
||||
} else {
|
||||
Logging.fine("Player: " + player.getName() + " is IMMUNE to gamemode changes!");
|
||||
}
|
||||
}
|
||||
} else if (world.getAllowFlight()) {
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
player.setAllowFlight(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logging.fine("The gamemode/allowfly was NOT changed for player '%s' because he is now in world '%s' instead of world '%s'",
|
||||
player.getName(), player.getWorld().getName(), world.getName());
|
||||
}
|
||||
} else {
|
||||
Logging.fine("Player: " + player.getName() + " is IMMUNE to gamemode changes!");
|
||||
}
|
||||
}, 1L);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import java.util.logging.Level;
|
||||
*/
|
||||
public class MVPortalListener implements Listener {
|
||||
|
||||
private MultiverseCore plugin;
|
||||
private final MultiverseCore plugin;
|
||||
|
||||
public MVPortalListener(MultiverseCore core) {
|
||||
this.plugin = core;
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.bukkit.event.weather.WeatherChangeEvent;
|
||||
* Multiverse's Weather {@link Listener}.
|
||||
*/
|
||||
public class MVWeatherListener implements Listener {
|
||||
private MultiverseCore plugin;
|
||||
private final MultiverseCore plugin;
|
||||
|
||||
public MVWeatherListener(MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.bukkit.event.world.WorldInitEvent;
|
||||
|
||||
public class MVWorldInitListener implements Listener {
|
||||
|
||||
MultiverseCore plugin;
|
||||
private final MultiverseCore plugin;
|
||||
|
||||
public MVWorldInitListener(MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.bukkit.event.world.WorldUnloadEvent;
|
||||
* Multiverse's World {@link Listener}.
|
||||
*/
|
||||
public class MVWorldListener implements Listener {
|
||||
private MultiverseCore plugin;
|
||||
private MVWorldManager worldManager;
|
||||
private final MultiverseCore plugin;
|
||||
private final MVWorldManager worldManager;
|
||||
|
||||
public MVWorldListener(MultiverseCore plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
Reference in new issue
Block a user