mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-23 02:55:52 +01:00
General cleanup.
This commit is contained in:
parent
bd7ad20b7b
commit
871a601e37
@ -70,7 +70,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
|||||||
|
|
||||||
private AnchorManager anchorManager = new AnchorManager(this);
|
private AnchorManager anchorManager = new AnchorManager(this);
|
||||||
// TODO please let's make this non-static
|
// TODO please let's make this non-static
|
||||||
private static MultiverseCoreConfiguration config;
|
private MultiverseCoreConfiguration config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is used to find out who is teleporting a player.
|
* This method is used to find out who is teleporting a player.
|
||||||
@ -489,13 +489,13 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
|||||||
* @param msg The message to log.
|
* @param msg The message to log.
|
||||||
*/
|
*/
|
||||||
public static void staticLog(Level level, String msg) {
|
public static void staticLog(Level level, String msg) {
|
||||||
if (level == Level.FINE && config.getGlobalDebug() >= 1) {
|
if (level == Level.FINE && MultiverseCoreConfiguration.getInstance().getGlobalDebug() >= 1) {
|
||||||
staticDebugLog(Level.INFO, msg);
|
staticDebugLog(Level.INFO, msg);
|
||||||
return;
|
return;
|
||||||
} else if (level == Level.FINER && config.getGlobalDebug() >= 2) {
|
} else if (level == Level.FINER && MultiverseCoreConfiguration.getInstance().getGlobalDebug() >= 2) {
|
||||||
staticDebugLog(Level.INFO, msg);
|
staticDebugLog(Level.INFO, msg);
|
||||||
return;
|
return;
|
||||||
} else if (level == Level.FINEST && config.getGlobalDebug() >= 3) {
|
} else if (level == Level.FINEST && MultiverseCoreConfiguration.getInstance().getGlobalDebug() >= 3) {
|
||||||
staticDebugLog(Level.INFO, msg);
|
staticDebugLog(Level.INFO, msg);
|
||||||
return;
|
return;
|
||||||
} else if (level != Level.FINE && level != Level.FINER && level != Level.FINEST) {
|
} else if (level != Level.FINE && level != Level.FINER && level != Level.FINEST) {
|
||||||
@ -864,6 +864,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static MultiverseCoreConfiguration getStaticConfig() {
|
public static MultiverseCoreConfiguration getStaticConfig() {
|
||||||
return config;
|
return MultiverseCoreConfiguration.getInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,26 @@ import me.main__.util.SerializationConfig.SerializationConfig;
|
|||||||
* Our configuration.
|
* Our configuration.
|
||||||
*/
|
*/
|
||||||
public class MultiverseCoreConfiguration extends SerializationConfig implements MultiverseCoreConfig {
|
public class MultiverseCoreConfiguration extends SerializationConfig implements MultiverseCoreConfig {
|
||||||
|
private static MultiverseCoreConfiguration instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the statically saved instance.
|
||||||
|
* @param instance The new instance.
|
||||||
|
*/
|
||||||
|
public static void setInstance(MultiverseCoreConfiguration instance) {
|
||||||
|
MultiverseCoreConfiguration.instance = instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the statically saved instance.
|
||||||
|
* @return The statically saved instance.
|
||||||
|
*/
|
||||||
|
public static MultiverseCoreConfiguration getInstance() {
|
||||||
|
if (instance == null)
|
||||||
|
throw new IllegalStateException("The instance wasn't set!");
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
@Property
|
@Property
|
||||||
private boolean enforceaccess;
|
private boolean enforceaccess;
|
||||||
@Property
|
@Property
|
||||||
@ -34,10 +54,12 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
|||||||
|
|
||||||
public MultiverseCoreConfiguration() {
|
public MultiverseCoreConfiguration() {
|
||||||
super();
|
super();
|
||||||
|
MultiverseCoreConfiguration.setInstance(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiverseCoreConfiguration(Map<String, Object> values) {
|
public MultiverseCoreConfiguration(Map<String, Object> values) {
|
||||||
super(values);
|
super(values);
|
||||||
|
MultiverseCoreConfiguration.setInstance(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +52,7 @@ public class ImportCommand extends MultiverseCommand {
|
|||||||
* @param worldFolder The File that may be a world.
|
* @param worldFolder The File that may be a world.
|
||||||
* @return True if it looks like a world, false if not.
|
* @return True if it looks like a world, false if not.
|
||||||
*/
|
*/
|
||||||
private boolean checkIfIsWorld(File worldFolder) {
|
private static boolean checkIfIsWorld(File worldFolder) {
|
||||||
if (worldFolder.isDirectory()) {
|
if (worldFolder.isDirectory()) {
|
||||||
File[] files = worldFolder.listFiles(new FilenameFilter() {
|
File[] files = worldFolder.listFiles(new FilenameFilter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -190,7 +190,7 @@ public class InfoCommand extends MultiverseCommand {
|
|||||||
return worldInfo;
|
return worldInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toCommaSeperated(List<String> list) {
|
private static String toCommaSeperated(List<String> list) {
|
||||||
if (list == null || list.size() == 0) {
|
if (list == null || list.size() == 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ public class InfoCommand extends MultiverseCommand {
|
|||||||
return positive ? ChatColor.GREEN : ChatColor.RED;
|
return positive ? ChatColor.GREEN : ChatColor.RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPage(int page, CommandSender sender, List<List<FancyText>> doc) {
|
private static void showPage(int page, CommandSender sender, List<List<FancyText>> doc) {
|
||||||
page = page < 0 ? 0 : page;
|
page = page < 0 ? 0 : page;
|
||||||
page = page > doc.size() - 1 ? doc.size() - 1 : page;
|
page = page > doc.size() - 1 ? doc.size() - 1 : page;
|
||||||
boolean altColor = false;
|
boolean altColor = false;
|
||||||
|
@ -65,7 +65,7 @@ public class PurgeCommand extends MultiverseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!worldName.equalsIgnoreCase("all") && !this.worldManager.isMVWorld(worldName)) {
|
if (!worldName.equalsIgnoreCase("all") && !this.worldManager.isMVWorld(worldName)) {
|
||||||
((MultiverseCore) this.plugin).showNotMVWorldMessage(sender, worldName);
|
this.plugin.showNotMVWorldMessage(sender, worldName);
|
||||||
sender.sendMessage("It cannot be purged.");
|
sender.sendMessage("It cannot be purged.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -50,12 +50,8 @@ public class TeleportCommand extends MultiverseCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runCommand(CommandSender sender, List<String> args) {
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
// Check if the command was sent from a Player.
|
|
||||||
CommandSender teleporter = sender;
|
CommandSender teleporter = sender;
|
||||||
Player teleportee = null;
|
Player teleportee = null;
|
||||||
if (sender instanceof Player) {
|
|
||||||
teleporter = (Player) sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
String destinationName;
|
String destinationName;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class WhoCommand extends MultiverseCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildPlayerString(MultiverseWorld world) {
|
private static String buildPlayerString(MultiverseWorld world) {
|
||||||
List<Player> players = world.getCBWorld().getPlayers();
|
List<Player> players = world.getCBWorld().getPlayers();
|
||||||
if (players.size() == 0) {
|
if (players.size() == 0) {
|
||||||
return "No players found.";
|
return "No players found.";
|
||||||
|
@ -54,7 +54,7 @@ public class DestinationFactory {
|
|||||||
Class<? extends MVDestination> myClass = this.destList.get(idenChar);
|
Class<? extends MVDestination> myClass = this.destList.get(idenChar);
|
||||||
try {
|
try {
|
||||||
MVDestination mydest = myClass.newInstance();
|
MVDestination mydest = myClass.newInstance();
|
||||||
if (!mydest.isThisType((MultiverseCore) this.plugin, destination)) {
|
if (!mydest.isThisType(this.plugin, destination)) {
|
||||||
return new InvalidDestination();
|
return new InvalidDestination();
|
||||||
}
|
}
|
||||||
mydest.setDestination(this.plugin, destination);
|
mydest.setDestination(this.plugin, destination);
|
||||||
|
@ -70,7 +70,7 @@ public class WorldDestination implements MVDestination {
|
|||||||
return spawnLoc;
|
return spawnLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Location getAcurateSpawnLocation(Entity e, MultiverseWorld world) {
|
private static Location getAcurateSpawnLocation(Entity e, MultiverseWorld world) {
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
return world.getSpawnLocation();
|
return world.getSpawnLocation();
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,7 +16,6 @@ import java.util.List;
|
|||||||
* Called when the Multiverse-config should be reloaded.
|
* Called when the Multiverse-config should be reloaded.
|
||||||
*/
|
*/
|
||||||
public class MVConfigReloadEvent extends Event {
|
public class MVConfigReloadEvent extends Event {
|
||||||
private static final long serialVersionUID = 3647950355746345397L;
|
|
||||||
private List<String> configsLoaded;
|
private List<String> configsLoaded;
|
||||||
|
|
||||||
public MVConfigReloadEvent(List<String> configsLoaded) {
|
public MVConfigReloadEvent(List<String> configsLoaded) {
|
||||||
|
@ -12,7 +12,7 @@ import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
|||||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||||
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.EntityType;
|
||||||
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.Player;
|
||||||
@ -99,14 +99,13 @@ public class MVEntityListener implements Listener {
|
|||||||
if (!(this.worldManager.isMVWorld(world.getName())))
|
if (!(this.worldManager.isMVWorld(world.getName())))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CreatureType creature = event.getCreatureType();
|
EntityType type = event.getEntityType();
|
||||||
|
|
||||||
MultiverseWorld mvworld = this.worldManager.getMVWorld(world.getName());
|
MultiverseWorld mvworld = this.worldManager.getMVWorld(world.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle people with non-standard animals: ie a patched craftbukkit.
|
* Handle people with non-standard animals: ie a patched craftbukkit.
|
||||||
*/
|
*/
|
||||||
if (creature == null) {
|
if (type == null) {
|
||||||
this.plugin.log(Level.FINER, "Found a null typed creature.");
|
this.plugin.log(Level.FINER, "Found a null typed creature.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -115,17 +114,17 @@ public class MVEntityListener implements Listener {
|
|||||||
* Animal Handling
|
* Animal Handling
|
||||||
*/
|
*/
|
||||||
if (event.getEntity() instanceof Animals || event.getEntity() instanceof Squid) {
|
if (event.getEntity() instanceof Animals || event.getEntity() instanceof Squid) {
|
||||||
event.setCancelled(this.shouldWeKillThisCreature(mvworld.getAnimalList(), mvworld.canAnimalsSpawn(), creature.toString().toUpperCase()));
|
event.setCancelled(shouldWeKillThisCreature(mvworld.getAnimalList(), mvworld.canAnimalsSpawn(), type.getName().toUpperCase()));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Monster Handling
|
* Monster Handling
|
||||||
*/
|
*/
|
||||||
if (event.getEntity() instanceof Monster || event.getEntity() instanceof Ghast || event.getEntity() instanceof Slime) {
|
if (event.getEntity() instanceof Monster || event.getEntity() instanceof Ghast || event.getEntity() instanceof Slime) {
|
||||||
event.setCancelled(this.shouldWeKillThisCreature(mvworld.getMonsterList(), mvworld.canMonstersSpawn(), creature.toString().toUpperCase()));
|
event.setCancelled(shouldWeKillThisCreature(mvworld.getMonsterList(), mvworld.canMonstersSpawn(), type.getName().toUpperCase()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldWeKillThisCreature(List<String> creatureList, boolean allowCreatureSpawning, String creature) {
|
private static boolean shouldWeKillThisCreature(List<String> creatureList, boolean allowCreatureSpawning, String creature) {
|
||||||
if (creatureList.isEmpty() && allowCreatureSpawning) {
|
if (creatureList.isEmpty() && allowCreatureSpawning) {
|
||||||
// 1. There are no exceptions and animals are allowed. Save it.
|
// 1. There are no exceptions and animals are allowed. Save it.
|
||||||
return false;
|
return false;
|
||||||
|
@ -41,7 +41,7 @@ public class MVPortalListener implements Listener {
|
|||||||
}
|
}
|
||||||
MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getBlocks().get(0).getWorld());
|
MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getBlocks().get(0).getWorld());
|
||||||
// We have to do it like this due to a bug in 1.1-R3
|
// We have to do it like this due to a bug in 1.1-R3
|
||||||
if (this.cancelPortalEvent(world, event.getPortalType())) {
|
if (cancelPortalEvent(world, event.getPortalType())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ public class MVPortalListener implements Listener {
|
|||||||
for (Block b : event.getBlocks()) {
|
for (Block b : event.getBlocks()) {
|
||||||
if (b.getType() == Material.PORTAL) {
|
if (b.getType() == Material.PORTAL) {
|
||||||
MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(b.getWorld());
|
MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(b.getWorld());
|
||||||
if (this.cancelPortalEvent(world, PortalType.NETHER)) {
|
if (cancelPortalEvent(world, PortalType.NETHER)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -67,12 +67,12 @@ public class MVPortalListener implements Listener {
|
|||||||
}
|
}
|
||||||
// If We're here, then the Portal was an Ender type:
|
// If We're here, then the Portal was an Ender type:
|
||||||
MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getBlocks().get(0).getWorld());
|
MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getBlocks().get(0).getWorld());
|
||||||
if (this.cancelPortalEvent(world, PortalType.ENDER)) {
|
if (cancelPortalEvent(world, PortalType.ENDER)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean cancelPortalEvent(MultiverseWorld world, PortalType type) {
|
private static boolean cancelPortalEvent(MultiverseWorld world, PortalType type) {
|
||||||
if (world.getAllowedPortals() == AllowedPortalType.NONE) {
|
if (world.getAllowedPortals() == AllowedPortalType.NONE) {
|
||||||
return true;
|
return true;
|
||||||
} else if (world.getAllowedPortals() != AllowedPortalType.ALL) {
|
} else if (world.getAllowedPortals() != AllowedPortalType.ALL) {
|
||||||
|
@ -20,9 +20,11 @@ public class FancyMessage implements FancyText {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows easy creation of an alternating colored list.
|
* Allows easy creation of an alternating colored list.
|
||||||
|
* TODO: Documentation! Why does CheckStyle just ignore this?
|
||||||
*
|
*
|
||||||
* @param title
|
* @param title
|
||||||
* @param message
|
* @param message
|
||||||
|
* @param scheme
|
||||||
*/
|
*/
|
||||||
public FancyMessage(String title, String message, FancyColorScheme scheme) {
|
public FancyMessage(String title, String message, FancyColorScheme scheme) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
|
@ -51,17 +51,17 @@ public class MVMessaging implements MultiverseMessaging {
|
|||||||
public boolean sendMessages(CommandSender sender, String[] messages, boolean ignoreCooldown) {
|
public boolean sendMessages(CommandSender sender, String[] messages, boolean ignoreCooldown) {
|
||||||
if (!(sender instanceof Player) || ignoreCooldown) {
|
if (!(sender instanceof Player) || ignoreCooldown) {
|
||||||
|
|
||||||
this.sendMessages(sender, messages);
|
sendMessages(sender, messages);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!this.sentList.containsKey(sender.getName())) {
|
if (!this.sentList.containsKey(sender.getName())) {
|
||||||
this.sendMessages(sender, messages);
|
sendMessages(sender, messages);
|
||||||
this.sentList.put(sender.getName(), System.currentTimeMillis());
|
this.sentList.put(sender.getName(), System.currentTimeMillis());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
if (time >= this.sentList.get(sender.getName()) + this.cooldown) {
|
if (time >= this.sentList.get(sender.getName()) + this.cooldown) {
|
||||||
this.sendMessages(sender, messages);
|
sendMessages(sender, messages);
|
||||||
this.sentList.put(sender.getName(), System.currentTimeMillis());
|
this.sentList.put(sender.getName(), System.currentTimeMillis());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ public class MVMessaging implements MultiverseMessaging {
|
|||||||
return this.sendMessages(sender, messages.toArray(new String[0]), ignoreCooldown);
|
return this.sendMessages(sender, messages.toArray(new String[0]), ignoreCooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessages(CommandSender sender, String[] messages) {
|
private static void sendMessages(CommandSender sender, String[] messages) {
|
||||||
for (String s : messages) {
|
for (String s : messages) {
|
||||||
sender.sendMessage(s);
|
sender.sendMessage(s);
|
||||||
}
|
}
|
||||||
|
@ -229,6 +229,7 @@ public class MVPermissions implements PermissionsInterface {
|
|||||||
* @param isOpRequired @Deprecated. This is not used for anything anymore.
|
* @param isOpRequired @Deprecated. This is not used for anything anymore.
|
||||||
* @return True if they have that permission or any parent.
|
* @return True if they have that permission or any parent.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
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;
|
||||||
@ -268,6 +269,7 @@ public class MVPermissions implements PermissionsInterface {
|
|||||||
* @param node The permission node to check (possibly already a parent).
|
* @param node The permission node to check (possibly already a parent).
|
||||||
* @return True if they have any parent perm, false if none.
|
* @return True if they have any parent perm, false if none.
|
||||||
*/
|
*/
|
||||||
|
// TODO remove this...?
|
||||||
private boolean hasAnyParentPermission(CommandSender sender, String node) {
|
private boolean hasAnyParentPermission(CommandSender sender, String node) {
|
||||||
String parentPerm = this.pullOneLevelOff(node);
|
String parentPerm = this.pullOneLevelOff(node);
|
||||||
// Base case
|
// Base case
|
||||||
@ -288,7 +290,7 @@ public class MVPermissions implements PermissionsInterface {
|
|||||||
* @param node The root node to check.
|
* @param node The root node to check.
|
||||||
* @return The parent of the node
|
* @return The parent of the node
|
||||||
*/
|
*/
|
||||||
private String pullOneLevelOff(String node) {
|
private static String pullOneLevelOff(String node) {
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -393,7 +395,7 @@ public class MVPermissions implements PermissionsInterface {
|
|||||||
/**
|
/**
|
||||||
* If the given permission was 'multiverse.core.tp.self', this would return 'multiverse.core.tp.*'.
|
* If the given permission was 'multiverse.core.tp.self', this would return 'multiverse.core.tp.*'.
|
||||||
*/
|
*/
|
||||||
private String getParentPerm(String[] seperated) {
|
private static String getParentPerm(String[] seperated) {
|
||||||
if (seperated.length == 1) {
|
if (seperated.length == 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -403,5 +405,4 @@ public class MVPermissions implements PermissionsInterface {
|
|||||||
}
|
}
|
||||||
return returnString + "*";
|
return returnString + "*";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public class PermissionTools {
|
|||||||
* @param separatedPermissionString The array of a dot separated perm string.
|
* @param separatedPermissionString The array of a dot separated perm string.
|
||||||
* @return The dot separated parent permission string.
|
* @return The dot separated parent permission string.
|
||||||
*/
|
*/
|
||||||
private String getParentPerm(String[] separatedPermissionString) {
|
private static String getParentPerm(String[] separatedPermissionString) {
|
||||||
if (separatedPermissionString.length == 1) {
|
if (separatedPermissionString.length == 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -65,24 +65,24 @@ public class SimpleBlockSafety implements BlockSafety {
|
|||||||
upOne.setY(upOne.getY() + 1);
|
upOne.setY(upOne.getY() + 1);
|
||||||
downOne.setY(downOne.getY() - 1);
|
downOne.setY(downOne.getY() - 1);
|
||||||
|
|
||||||
if (this.isSolidBlock(world.getBlockAt(actual).getType())
|
if (isSolidBlock(world.getBlockAt(actual).getType())
|
||||||
|| this.isSolidBlock(upOne.getBlock().getType())) {
|
|| isSolidBlock(upOne.getBlock().getType())) {
|
||||||
MultiverseCore.staticLog(Level.FINER, "Error Here (Actual)? ("
|
MultiverseCore.staticLog(Level.FINER, "Error Here (Actual)? ("
|
||||||
+ actual.getBlock().getType() + ")[" + this.isSolidBlock(actual.getBlock().getType()) + "]");
|
+ actual.getBlock().getType() + ")[" + isSolidBlock(actual.getBlock().getType()) + "]");
|
||||||
MultiverseCore.staticLog(Level.FINER, "Error Here (upOne)? ("
|
MultiverseCore.staticLog(Level.FINER, "Error Here (upOne)? ("
|
||||||
+ upOne.getBlock().getType() + ")[" + this.isSolidBlock(upOne.getBlock().getType()) + "]");
|
+ upOne.getBlock().getType() + ")[" + isSolidBlock(upOne.getBlock().getType()) + "]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downOne.getBlock().getType() == Material.LAVA || downOne.getBlock().getType() == Material.STATIONARY_LAVA) {
|
if (downOne.getBlock().getType() == Material.LAVA || downOne.getBlock().getType() == Material.STATIONARY_LAVA) {
|
||||||
MultiverseCore.staticLog(Level.FINER, "Error Here (downOne)? ("
|
MultiverseCore.staticLog(Level.FINER, "Error Here (downOne)? ("
|
||||||
+ downOne.getBlock().getType() + ")[" + this.isSolidBlock(downOne.getBlock().getType()) + "]");
|
+ downOne.getBlock().getType() + ")[" + isSolidBlock(downOne.getBlock().getType()) + "]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downOne.getBlock().getType() == Material.FIRE) {
|
if (downOne.getBlock().getType() == Material.FIRE) {
|
||||||
MultiverseCore.staticLog(Level.FINER, "There's fire below! ("
|
MultiverseCore.staticLog(Level.FINER, "There's fire below! ("
|
||||||
+ actual.getBlock().getType() + ")[" + this.isSolidBlock(actual.getBlock().getType()) + "]");
|
+ actual.getBlock().getType() + ")[" + isSolidBlock(actual.getBlock().getType()) + "]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ public class SimpleBlockSafety implements BlockSafety {
|
|||||||
/*
|
/*
|
||||||
* If someone has a better way of this... Please either tell us, or submit a pull request!
|
* If someone has a better way of this... Please either tell us, or submit a pull request!
|
||||||
*/
|
*/
|
||||||
private boolean isSolidBlock(Material type) {
|
private static boolean isSolidBlock(Material type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AIR:
|
case AIR:
|
||||||
return false;
|
return false;
|
||||||
|
@ -155,18 +155,6 @@ public class WorldManager implements MVWorldManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Verifies that a given Plugin generator string exists.
|
|
||||||
*
|
|
||||||
* @param generator The name of the generator plugin. This should be something like CleanRoomGenerator.
|
|
||||||
* @return True if the plugin exists and is enabled, false if not.
|
|
||||||
*/
|
|
||||||
// TODO maybe remove this since it's unused?
|
|
||||||
private boolean pluginExists(String generator) {
|
|
||||||
Plugin myPlugin = this.plugin.getServer().getPluginManager().getPlugin(generator);
|
|
||||||
return myPlugin != null && myPlugin.isEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -8,7 +8,6 @@ import java.net.MalformedURLException;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pastes to {@code pastebin.com}.
|
* Pastes to {@code pastebin.com}.
|
||||||
@ -75,18 +74,4 @@ public class PastebinPasteService implements PasteService {
|
|||||||
throw new PasteFailedException(e);
|
throw new PasteFailedException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO maybe remove this?
|
|
||||||
private Pattern getURLMatchingPattern() {
|
|
||||||
if (this.isPrivate) {
|
|
||||||
return Pattern.compile(".*http://pastie.org/.*key=([0-9a-z]+).*");
|
|
||||||
} else {
|
|
||||||
return Pattern.compile(".*http://pastie.org/([0-9]+).*");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO maybe remove this?
|
|
||||||
private String formatURL(String pastieID) {
|
|
||||||
return "http://pastie.org/" + (this.isPrivate ? "private/" : "") + pastieID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user