mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-23 07:51:46 +01:00
Merge branch 'master' of github.com:Multiverse/Multiverse-Core
This commit is contained in:
commit
77ced857ea
@ -45,7 +45,7 @@ public class MVWorld implements MultiverseWorld {
|
||||
private String name; // The Worlds Name, EG its folder name.
|
||||
|
||||
private Map<String, List<String>> masterList;
|
||||
private Map<String, MVConfigProperty> propertyList;
|
||||
private Map<String, MVConfigProperty<?>> propertyList;
|
||||
private String generator;
|
||||
|
||||
private Permission permission;
|
||||
@ -82,7 +82,7 @@ public class MVWorld implements MultiverseWorld {
|
||||
|
||||
// Start NEW config awesomeness.
|
||||
ConfigPropertyFactory fac = new ConfigPropertyFactory(this.worldSection);
|
||||
this.propertyList = new HashMap<String, MVConfigProperty>();
|
||||
this.propertyList = new HashMap<String, MVConfigProperty<?>>();
|
||||
// The format of these are either:
|
||||
// getNewProperty(name, defaultValue, helpText)
|
||||
// or
|
||||
@ -344,8 +344,8 @@ public class MVWorld implements MultiverseWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MVConfigProperty getProperty(String name) throws PropertyDoesNotExistException {
|
||||
MVConfigProperty p = this.getKnownProperty(name);
|
||||
public MVConfigProperty<?> getProperty(String name) throws PropertyDoesNotExistException {
|
||||
MVConfigProperty<?> p = this.getKnownProperty(name);
|
||||
if (p == null) {
|
||||
throw new PropertyDoesNotExistException(name);
|
||||
}
|
||||
@ -358,7 +358,7 @@ public class MVWorld implements MultiverseWorld {
|
||||
* @param name The known name of a property
|
||||
* @return The property object.
|
||||
*/
|
||||
private MVConfigProperty getKnownProperty(String name) {
|
||||
private MVConfigProperty<?> getKnownProperty(String name) {
|
||||
if (this.propertyList.containsKey(name)) {
|
||||
return this.propertyList.get(name);
|
||||
} else if (this.propertyAliases.containsKey(name)) {
|
||||
@ -377,7 +377,7 @@ public class MVWorld implements MultiverseWorld {
|
||||
* @return True if the property was saved, false if not.
|
||||
*/
|
||||
private boolean setKnownProperty(String name, String value, CommandSender sender) {
|
||||
MVConfigProperty property;
|
||||
MVConfigProperty<?> property;
|
||||
if (this.propertyList.containsKey(name)) {
|
||||
property = this.getKnownProperty(name);
|
||||
} else if (this.propertyAliases.containsKey(name)) {
|
||||
|
@ -53,8 +53,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
|
||||
/**
|
||||
* This method is used to find out who is teleporting a player.
|
||||
* @param playerName
|
||||
* @return
|
||||
* @param playerName The teleported player.
|
||||
* @return The player that teleported the other one.
|
||||
*/
|
||||
public static String getPlayerTeleporter(String playerName) {
|
||||
if(teleportQueue.containsKey(playerName)) {
|
||||
@ -370,9 +370,9 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab and return the Teleport class.
|
||||
* Grab and return the {@link SafeTTeleporter}.
|
||||
*
|
||||
* @return
|
||||
* @return The {@link SafeTTeleporter}.
|
||||
*/
|
||||
public SafeTTeleporter getTeleporter() {
|
||||
return new SafeTTeleporter(this);
|
||||
@ -405,8 +405,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
* Print messages to the server Log as well as to our DebugLog. 'debugLog' is used to seperate Heroes information
|
||||
* from the Servers Log Output.
|
||||
*
|
||||
* @param level
|
||||
* @param msg
|
||||
* @param level The Log-{@link Level}
|
||||
* @param msg The message
|
||||
*/
|
||||
public void log(Level level, String msg) {
|
||||
staticLog(level, msg);
|
||||
@ -432,8 +432,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
* Print messages to the Debug Log, if the servers in Debug Mode then we also wan't to print the messages to the
|
||||
* standard Server Console.
|
||||
*
|
||||
* @param level
|
||||
* @param msg
|
||||
* @param level The Log-{@link Level}
|
||||
* @param msg The message
|
||||
*/
|
||||
public static void staticDebugLog(Level level, String msg) {
|
||||
log.log(level, "[MVCore-Debug] " + msg);
|
||||
@ -443,7 +443,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
/**
|
||||
* Parse the Authors Array into a readable String with ',' and 'and'.
|
||||
*
|
||||
* @return
|
||||
* @return The readable authors-{@link String}
|
||||
*/
|
||||
private String getAuthors() {
|
||||
String authors = "";
|
||||
@ -476,9 +476,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
|
||||
/**
|
||||
* This code should get moved somewhere more appropriate, but for now, it's here.
|
||||
*
|
||||
* @param env
|
||||
* @return
|
||||
*/
|
||||
public Environment getEnvFromString(String env) {
|
||||
// Don't reference the enum directly as there aren't that many, and we can be more forgiving to users this way
|
||||
@ -513,7 +510,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
/**
|
||||
* Returns the number of plugins that have specifically hooked into core.
|
||||
*
|
||||
* @return
|
||||
* @return The number if plugins that have hooked into core.
|
||||
*/
|
||||
public int getPluginCount() {
|
||||
return this.pluginCount;
|
||||
|
@ -49,7 +49,7 @@ public interface MultiverseWorld {
|
||||
* @return A valid MVWorldProperty.
|
||||
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
|
||||
*/
|
||||
public MVConfigProperty getProperty(String property) throws PropertyDoesNotExistException;
|
||||
public MVConfigProperty<?> getProperty(String property) throws PropertyDoesNotExistException;
|
||||
|
||||
/**
|
||||
* Gets the string representation of a property.
|
||||
|
@ -9,7 +9,6 @@ package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.utils.WorldManager;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
|
@ -9,7 +9,6 @@ package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -11,7 +11,6 @@ import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.enums.Action;
|
||||
import com.onarandombox.MultiverseCore.utils.WorldManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -12,7 +12,6 @@ import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
|
||||
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
|
||||
import com.onarandombox.MultiverseCore.utils.WorldManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -10,7 +10,6 @@ package com.onarandombox.MultiverseCore.commands;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.utils.WorldManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -17,6 +17,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class MVConfigMigrator {
|
||||
public List<String> createdDefaults = new ArrayList<String>();
|
||||
|
||||
|
@ -53,9 +53,9 @@ public class MVTeleportEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the player who requested the Teleport
|
||||
* Gets the {@link CommandSender} who requested the Teleport
|
||||
*
|
||||
* @return
|
||||
* @return The {@link CommandSender} who requested the Teleport
|
||||
*/
|
||||
public CommandSender getTeleporter() {
|
||||
return this.teleporter;
|
||||
|
@ -11,9 +11,6 @@ import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.utils.PermissionTools;
|
||||
import com.onarandombox.MultiverseCore.utils.SafeTTeleporter;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.entity.*;
|
||||
|
@ -43,10 +43,11 @@ public class BlockSafety {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks whether the block at the coordinates given is safe or not by checking for Laval/Fire/Air
|
||||
* This function checks whether the block at the coordinates given is safe or not by checking for Lava/Fire/Air
|
||||
* etc. This also ensures there is enough space for a player to spawn!
|
||||
*
|
||||
* @return
|
||||
* @param l The {@link Location}
|
||||
* @return Whether the player can spawn safely at the given {@link Location}
|
||||
*/
|
||||
public boolean playerCanSpawnHereSafely(Location l) {
|
||||
World world = l.getWorld();
|
||||
@ -107,9 +108,6 @@ public class BlockSafety {
|
||||
|
||||
/**
|
||||
* If someone has a better way of this... Please either tell us, or submit a pull request!
|
||||
*
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
private boolean isSolidBlock(Material type) {
|
||||
switch (type) {
|
||||
@ -196,10 +194,10 @@ public class BlockSafety {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks recursively below location L for 2 blocks of water
|
||||
* Checks recursively below a {@link Location} for 2 blocks of water
|
||||
*
|
||||
* @param l
|
||||
* @return
|
||||
* @param l The {@link Location}
|
||||
* @return Whether there are 2 blocks of water
|
||||
*/
|
||||
public boolean hasTwoBlocksofWaterBelow(Location l) {
|
||||
if (l.getBlockY() < 0) {
|
||||
|
@ -15,7 +15,6 @@ import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Formatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -37,10 +36,10 @@ public class LocationManipulation {
|
||||
|
||||
/**
|
||||
* Convert a Location into a Colon separated string to allow us to store it in text.
|
||||
* <p/>
|
||||
* <p>
|
||||
* WORLD:X,Y,Z:yaw:pitch
|
||||
* <p/>
|
||||
* The corresponding String2Loc function is {@link #stringToLocation }
|
||||
* <p>
|
||||
* The corresponding String2Loc function is {@link #stringToLocation}
|
||||
*
|
||||
* @param location The Location to save.
|
||||
* @return The location as a string in this format: WORLD:x,y,z:yaw:pitch
|
||||
@ -57,10 +56,10 @@ public class LocationManipulation {
|
||||
|
||||
/**
|
||||
* Returns a new location from a given string. The format is as follows:
|
||||
* <p/>
|
||||
* <p>
|
||||
* WORLD:X,Y,Z:yaw:pitch
|
||||
* <p/>
|
||||
* The corresponding Location2String function is {@link #stringToLocation }
|
||||
* <p>
|
||||
* The corresponding Location2String function is {@link #stringToLocation}
|
||||
*
|
||||
* @param locationString The location represented as a string (WORLD:X,Y,Z:yaw:pitch)
|
||||
* @return A new location defined by the string or null if the string was invalid.
|
||||
@ -109,8 +108,8 @@ public class LocationManipulation {
|
||||
/**
|
||||
* Returns a colored string with the coords
|
||||
*
|
||||
* @param l
|
||||
* @return
|
||||
* @param l The {@link Location}
|
||||
* @return The {@link String}
|
||||
*/
|
||||
public static String strCoords(Location l) {
|
||||
String result = "";
|
||||
@ -128,8 +127,8 @@ public class LocationManipulation {
|
||||
/**
|
||||
* Converts a location to a printable readable formatted string including pitch/yaw
|
||||
*
|
||||
* @param l
|
||||
* @return
|
||||
* @param l The {@link Location}
|
||||
* @return The {@link String}
|
||||
*/
|
||||
public static String strCoordsRaw(Location l) {
|
||||
String result = "";
|
||||
@ -147,8 +146,8 @@ public class LocationManipulation {
|
||||
/**
|
||||
* Return the NESW Direction a Location is facing.
|
||||
*
|
||||
* @param location
|
||||
* @return
|
||||
* @param location The {@link Location}
|
||||
* @return The NESW Direction
|
||||
*/
|
||||
public static String getDirection(Location location) {
|
||||
double r = (location.getYaw() % 360) + 180;
|
||||
@ -177,10 +176,10 @@ public class LocationManipulation {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the float yaw position for the given cardianl direction
|
||||
* Returns the float yaw position for the given cardinal direction
|
||||
*
|
||||
* @param orientation
|
||||
* @return
|
||||
* @param orientation The cardinal direction
|
||||
* @return The yaw
|
||||
*/
|
||||
public static float getYaw(String orientation) {
|
||||
if (orientation == null) {
|
||||
@ -195,8 +194,8 @@ public class LocationManipulation {
|
||||
/**
|
||||
* Returns a speed float from a given vector.
|
||||
*
|
||||
* @param v
|
||||
* @return
|
||||
* @param v The {@link Vector}
|
||||
* @return The speed
|
||||
*/
|
||||
public static float getSpeed(Vector v) {
|
||||
return (float) Math.sqrt(v.getX() * v.getX() + v.getZ() * v.getZ());
|
||||
@ -208,9 +207,9 @@ public class LocationManipulation {
|
||||
/**
|
||||
* Returns a translated vector from the given direction
|
||||
*
|
||||
* @param v
|
||||
* @param direction
|
||||
* @return
|
||||
* @param v The old {@link Vector}
|
||||
* @param direction The new direction
|
||||
* @return The translated {@link Vector}
|
||||
*/
|
||||
public static Vector getTranslatedVector(Vector v, String direction) {
|
||||
if (direction == null) {
|
||||
@ -240,10 +239,10 @@ public class LocationManipulation {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next Location that an entity is traveling at
|
||||
* Returns the next Location that a {@link Vehicle} is traveling at
|
||||
*
|
||||
* @param v
|
||||
* @return
|
||||
* @param v The {@link Vehicle}
|
||||
* @return The {@link Location}
|
||||
*/
|
||||
public static Location getNextBlock(Vehicle v) {
|
||||
Vector vector = v.getVelocity();
|
||||
|
@ -39,9 +39,9 @@ public class MVPermissions implements PermissionsInterface {
|
||||
/**
|
||||
* Check if a Player can teleport to the Destination world from there current world.
|
||||
*
|
||||
* @param p The player to check.
|
||||
* @param w
|
||||
* @return
|
||||
* @param p The {@link Player} to check.
|
||||
* @param w The {@link MultiverseWorld} the player wants to teleport to.
|
||||
* @return Whether the player can teleport to the given {@link MultiverseWorld}.
|
||||
*/
|
||||
public boolean canTravelFromWorld(Player p, MultiverseWorld w) {
|
||||
List<String> blackList = w.getWorldBlacklist();
|
||||
@ -72,9 +72,9 @@ public class MVPermissions implements PermissionsInterface {
|
||||
/**
|
||||
* Check if the Player has the permissions to enter this world.
|
||||
*
|
||||
* @param p
|
||||
* @param w
|
||||
* @return
|
||||
* @param p The {@link Player} player that wants to enter
|
||||
* @param w The {@link MultiverseWorld} he wants to enter
|
||||
* @return Whether he has the permission to enter the world
|
||||
*/
|
||||
public boolean canEnterWorld(Player p, MultiverseWorld w) {
|
||||
// If we're not enforcing access, anyone can enter.
|
||||
@ -285,9 +285,6 @@ public class MVPermissions implements PermissionsInterface {
|
||||
|
||||
/**
|
||||
* If the given permission was 'multiverse.core.tp.self', this would return 'multiverse.core.tp.*'.
|
||||
*
|
||||
* @param seperated
|
||||
* @return
|
||||
*/
|
||||
private String getParentPerm(String[] seperated) {
|
||||
if (seperated.length == 1) {
|
||||
|
@ -35,8 +35,6 @@ public class MVPlayerSession {
|
||||
|
||||
/**
|
||||
* Grab whether the cooldown on Portal use has expired or not.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean getTeleportable() {
|
||||
Long time = (new Date()).getTime();
|
||||
|
@ -85,11 +85,10 @@ public class UpdateChecker {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given Version String to a Normalised Version String so we can compare it.
|
||||
* Convert the given Version String to a Normalized Version String so we can compare it.
|
||||
*
|
||||
* @param version
|
||||
*
|
||||
* @return
|
||||
* @param version The version string
|
||||
* @return The normalized version string
|
||||
*/
|
||||
public static String normalisedVersion(String version) {
|
||||
return normalisedVersion(version, ".", 4);
|
||||
|
@ -8,7 +8,6 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class PastebinPasteService implements PasteService {
|
||||
|
Loading…
Reference in New Issue
Block a user