mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 10:36:06 +01:00
Merge branch 'master' of github.com:Multiverse/Multiverse-Core
This commit is contained in:
commit
9963e6f29f
@ -61,7 +61,9 @@
|
||||
</module>
|
||||
<module name="IllegalImport"/>
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports"/>
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="true"/>
|
||||
</module>
|
||||
<module name="MethodLength"/>
|
||||
<module name="ParameterNumber"/>
|
||||
<module name="EmptyForIteratorPad"/>
|
||||
@ -94,9 +96,10 @@
|
||||
<module name="IllegalInstantiation"/>
|
||||
<module name="InnerAssignment"/>
|
||||
<module name="MagicNumber">
|
||||
<property name="ignoreNumbers" value="-1, 0, 1, 2, 3, 7, 8, 5000"/>
|
||||
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2, 3, 4, 5 7, 8, 5000"/>
|
||||
<!-- Explanations why we ignore certain magic numbers: -->
|
||||
<!-- 3: Log-level -->
|
||||
<!-- 4, 5: Array-indexes in Destinations -->
|
||||
<!-- 8: Default nether scale in MVWorld -->
|
||||
<!-- 7: max number of args in CreateCommand -->
|
||||
<!-- 5000: Default messagecooldown in MultiverseCore -->
|
||||
|
@ -420,6 +420,7 @@ public class MVWorld implements MultiverseWorld {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Use {@link #getProperty(String, Class)} instead
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
@ -705,6 +706,7 @@ public class MVWorld implements MultiverseWorld {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This is deprecated.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
|
@ -21,6 +21,7 @@ import com.onarandombox.MultiverseCore.destination.DestinationFactory;
|
||||
import com.onarandombox.MultiverseCore.destination.ExactDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.PlayerDestination;
|
||||
import com.onarandombox.MultiverseCore.destination.WorldDestination;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVEntityListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPlayerListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVPluginListener;
|
||||
@ -110,9 +111,14 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
return "The Multiverse-Core Plugin";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This is now deprecated, nobody needs it any longer.
|
||||
* All version info-dumping is now done with {@link MVVersionEvent}.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public String dumpVersionInfo(String buffer) {
|
||||
// I'm kinda cheating on this one, since we call the init event.
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
||||
|
||||
/**
|
||||
* This interface is implemented by every official Multiverse-plugin.
|
||||
@ -19,7 +20,11 @@ public interface MVPlugin extends LoggablePlugin {
|
||||
* @param buffer The string that contains Core and all other MV plugins' versions.
|
||||
*
|
||||
* @return A modified buffer that contains this MVPlugin's version information.
|
||||
*
|
||||
* @deprecated This is now deprecated, nobody needs it any longer.
|
||||
* All version info-dumping is now done with {@link MVVersionEvent}.
|
||||
*/
|
||||
@Deprecated
|
||||
String dumpVersionInfo(String buffer);
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,7 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionRequestEvent;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteFailedException;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteService;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteServiceFactory;
|
||||
@ -38,8 +38,6 @@ public class VersionCommand extends MultiverseCommand {
|
||||
"Dumps version info to the console, optionally to pastie.org with -p or pastebin.com with a -b.", PermissionDefault.TRUE);
|
||||
}
|
||||
|
||||
private String pasteBinBuffer = "";
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
// Check if the command was sent from a Player.
|
||||
@ -47,33 +45,41 @@ public class VersionCommand extends MultiverseCommand {
|
||||
sender.sendMessage("Version info dumped to console. Please check your server logs.");
|
||||
}
|
||||
|
||||
logAndAddToPasteBinBuffer("Multiverse-Core Version: " + this.plugin.getDescription().getVersion());
|
||||
logAndAddToPasteBinBuffer("Bukkit Version: " + this.plugin.getServer().getVersion());
|
||||
logAndAddToPasteBinBuffer("Loaded Worlds: " + this.plugin.getMVWorldManager().getMVWorlds().size());
|
||||
logAndAddToPasteBinBuffer("Multiverse Plugins Loaded: " + this.plugin.getPluginCount());
|
||||
logAndAddToPasteBinBuffer("Economy being used: " + this.plugin.getBank().getEconUsed());
|
||||
logAndAddToPasteBinBuffer("Permissions Plugin: " + this.plugin.getMVPerms().getType());
|
||||
logAndAddToPasteBinBuffer("Dumping Config Values: (version " + this.plugin.getMVConfiguration().getString("version", "NOT SET") + ")");
|
||||
logAndAddToPasteBinBuffer("messagecooldown: " + "Not yet IMPLEMENTED");
|
||||
logAndAddToPasteBinBuffer("teleportcooldown: " + "Not yet IMPLEMENTED");
|
||||
logAndAddToPasteBinBuffer("worldnameprefix: " + MultiverseCore.PrefixChat);
|
||||
logAndAddToPasteBinBuffer("enforceaccess: " + MultiverseCore.EnforceAccess);
|
||||
logAndAddToPasteBinBuffer("enforcegamemodes: " + MultiverseCore.EnforceGameModes);
|
||||
logAndAddToPasteBinBuffer("displaypermerrors: " + MultiverseCore.DisplayPermErrors);
|
||||
logAndAddToPasteBinBuffer("teleportintercept: " + MultiverseCore.TeleportIntercept);
|
||||
logAndAddToPasteBinBuffer("debug: " + MultiverseCore.GlobalDebug);
|
||||
logAndAddToPasteBinBuffer("Special Code: FRN002");
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("[Multiverse-Core] Multiverse-Core Version: ").append(this.plugin.getDescription().getVersion()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Bukkit Version: ").append(this.plugin.getServer().getVersion()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Loaded Worlds: ").append(this.plugin.getMVWorldManager().getMVWorlds().size()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Multiverse Plugins Loaded: ").append(this.plugin.getPluginCount()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Economy being used: ").append(this.plugin.getBank().getEconUsed()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Permissions Plugin: ").append(this.plugin.getMVPerms().getType()).append('\n');
|
||||
buffer.append("[Multiverse-Core] Dumping Config Values: (version ")
|
||||
.append(this.plugin.getMVConfiguration().getString("version", "NOT SET")).append(")").append('\n');
|
||||
buffer.append("[Multiverse-Core] messagecooldown: ").append("Not yet IMPLEMENTED").append('\n');
|
||||
buffer.append("[Multiverse-Core] teleportcooldown: ").append("Not yet IMPLEMENTED").append('\n');
|
||||
buffer.append("[Multiverse-Core] worldnameprefix: ").append(MultiverseCore.PrefixChat).append('\n');
|
||||
buffer.append("[Multiverse-Core] enforceaccess: ").append(MultiverseCore.EnforceAccess).append('\n');
|
||||
buffer.append("[Multiverse-Core] enforcegamemodes: ").append(MultiverseCore.EnforceGameModes).append('\n');
|
||||
buffer.append("[Multiverse-Core] displaypermerrors: ").append(MultiverseCore.DisplayPermErrors).append('\n');
|
||||
buffer.append("[Multiverse-Core] teleportintercept: ").append(MultiverseCore.TeleportIntercept).append('\n');
|
||||
buffer.append("[Multiverse-Core] debug: ").append(MultiverseCore.GlobalDebug).append('\n');
|
||||
buffer.append("[Multiverse-Core] Special Code: FRN002").append('\n');
|
||||
|
||||
MVVersionRequestEvent versionEvent = new MVVersionRequestEvent(pasteBinBuffer);
|
||||
MVVersionEvent versionEvent = new MVVersionEvent(buffer.toString());
|
||||
this.plugin.getServer().getPluginManager().callEvent(versionEvent);
|
||||
pasteBinBuffer = versionEvent.getPasteBinBuffer();
|
||||
|
||||
// log to console
|
||||
String data = versionEvent.getVersionInfo();
|
||||
String[] lines = data.split("\n");
|
||||
for (String line : lines) {
|
||||
this.plugin.log(Level.INFO, line);
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
String pasteUrl = "";
|
||||
if (args.get(0).equalsIgnoreCase("-p")) {
|
||||
pasteUrl = this.postToService(PasteServiceType.PASTIE, true); // private post to pastie
|
||||
pasteUrl = postToService(PasteServiceType.PASTIE, true, data); // private post to pastie
|
||||
} else if (args.get(0).equalsIgnoreCase("-b")) {
|
||||
pasteUrl = this.postToService(PasteServiceType.PASTEBIN, true); // private post to pastie
|
||||
pasteUrl = postToService(PasteServiceType.PASTEBIN, true, data); // private post to pastie
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@ -83,11 +89,6 @@ public class VersionCommand extends MultiverseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private void logAndAddToPasteBinBuffer(String string) {
|
||||
this.pasteBinBuffer += "[Multiverse-Core] " + string + "\n";
|
||||
this.plugin.log(Level.INFO, string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the current contents of this.pasteBinBuffer to a web service.
|
||||
*
|
||||
@ -95,10 +96,10 @@ public class VersionCommand extends MultiverseCommand {
|
||||
* @param isPrivate Should the paste be marked as private.
|
||||
* @return URL of visible paste
|
||||
*/
|
||||
private String postToService(PasteServiceType type, boolean isPrivate) {
|
||||
private static String postToService(PasteServiceType type, boolean isPrivate, String pasteData) {
|
||||
PasteService ps = PasteServiceFactory.getService(type, isPrivate);
|
||||
try {
|
||||
return ps.postData(ps.encodeData(this.pasteBinBuffer), ps.getPostURL());
|
||||
return ps.postData(ps.encodeData(pasteData), ps.getPostURL());
|
||||
} catch (PasteFailedException e) {
|
||||
System.out.print(e);
|
||||
return "Error posting to service";
|
||||
|
@ -17,21 +17,34 @@ import org.bukkit.util.Vector;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An anchor-{@link MVDestination}.
|
||||
*/
|
||||
public class AnchorDestination implements MVDestination {
|
||||
private boolean isValid;
|
||||
private Location location;
|
||||
private MultiverseCore plugin;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "a";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Vector getVelocity() {
|
||||
return new Vector(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isThisType(JavaPlugin plugin, String destination) {
|
||||
if (!(plugin instanceof MultiverseCore)) {
|
||||
@ -47,16 +60,25 @@ public class AnchorDestination implements MVDestination {
|
||||
return parsed.get(0).equalsIgnoreCase("a");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Location getLocation(Entity e) {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return this.isValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDestination(JavaPlugin plugin, String destination) {
|
||||
if (!(plugin instanceof MultiverseCore)) {
|
||||
@ -73,7 +95,7 @@ public class AnchorDestination implements MVDestination {
|
||||
}
|
||||
this.name = parsed.get(1);
|
||||
this.location = this.plugin.getAnchorManager().getAnchorLocation(parsed.get(1));
|
||||
if(this.location == null) {
|
||||
if (this.location == null) {
|
||||
this.isValid = false;
|
||||
return;
|
||||
}
|
||||
@ -83,11 +105,17 @@ public class AnchorDestination implements MVDestination {
|
||||
this.isValid = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getType() {
|
||||
return "Anchor";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Anchor: " + this.name;
|
||||
@ -101,11 +129,17 @@ public class AnchorDestination implements MVDestination {
|
||||
return "i:Invalid Destination";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getRequiredPermission() {
|
||||
return "multiverse.access." + this.location.getWorld().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean useSafeTeleporter() {
|
||||
// This is an ANCHOR destination, don't safely teleport here.
|
||||
|
@ -14,16 +14,25 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* A bed-{@link MVDestination}.
|
||||
*/
|
||||
public class BedDestination implements MVDestination {
|
||||
|
||||
private boolean isValid;
|
||||
private Location knownBedLoc;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "b";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isThisType(JavaPlugin plugin, String destination) {
|
||||
String[] split = destination.split(":");
|
||||
@ -31,6 +40,9 @@ public class BedDestination implements MVDestination {
|
||||
return this.isValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Location getLocation(Entity entity) {
|
||||
if (entity instanceof Player) {
|
||||
@ -40,31 +52,49 @@ public class BedDestination implements MVDestination {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Vector getVelocity() {
|
||||
return new Vector();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDestination(JavaPlugin plugin, String destination) {
|
||||
// Not needed.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return this.isValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getType() {
|
||||
return "Bed";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Bed";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getRequiredPermission() {
|
||||
if (knownBedLoc != null) {
|
||||
@ -73,6 +103,9 @@ public class BedDestination implements MVDestination {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean useSafeTeleporter() {
|
||||
// Bukkit should have already checked this.
|
||||
|
@ -17,12 +17,19 @@ import org.bukkit.util.Vector;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A cannon-{@link MVDestination}.
|
||||
*/
|
||||
public class CannonDestination implements MVDestination {
|
||||
private final String coordRegex = "(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*)";
|
||||
private boolean isValid;
|
||||
private Location location;
|
||||
private double speed;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Vector getVelocity() {
|
||||
double pitchRadians = Math.toRadians(location.getPitch());
|
||||
double yawRadians = Math.toRadians(location.getYaw());
|
||||
@ -35,20 +42,28 @@ public class CannonDestination implements MVDestination {
|
||||
return new Vector(x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "ca";
|
||||
}
|
||||
|
||||
// NEED ca:world:x,y,z:pitch:yaw:speed
|
||||
// so basically 6
|
||||
private static final int SPLIT_SIZE = 6;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isThisType(JavaPlugin plugin, String destination) {
|
||||
if (!(plugin instanceof MultiverseCore)) {
|
||||
return false;
|
||||
}
|
||||
List<String> parsed = Arrays.asList(destination.split(":"));
|
||||
// NEED ca:world:x,y,z:pitch:yaw:speed
|
||||
// so basically 6
|
||||
if (parsed.size() != 6) {
|
||||
if (parsed.size() != SPLIT_SIZE) {
|
||||
return false;
|
||||
}
|
||||
// If it's not an Cannon type
|
||||
@ -75,26 +90,33 @@ public class CannonDestination implements MVDestination {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Location getLocation(Entity e) {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return this.isValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDestination(JavaPlugin plugin, String destination) {
|
||||
if (!(plugin instanceof MultiverseCore)) {
|
||||
return;
|
||||
}
|
||||
List<String> parsed = Arrays.asList(destination.split(":"));
|
||||
// Need at least: e:world:x,y,z
|
||||
// OR e:world:x,y,z:pitch:yaw
|
||||
// so basically 3 or 5
|
||||
if (parsed.size() != 6) {
|
||||
|
||||
if (parsed.size() != SPLIT_SIZE) {
|
||||
this.isValid = false;
|
||||
return;
|
||||
}
|
||||
@ -141,18 +163,30 @@ public class CannonDestination implements MVDestination {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getType() {
|
||||
return "Cannon!";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Cannon (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ() + ":" +
|
||||
this.location.getPitch() + ":" + this.location.getYaw() + ":" + this.speed + ")";
|
||||
return "Cannon (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ() + ":"
|
||||
+ this.location.getPitch() + ":" + this.location.getYaw() + ":" + this.speed + ")";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this {@link CannonDestination}.
|
||||
*
|
||||
* @param location The {@link Location}.
|
||||
* @param speed The speed.
|
||||
*/
|
||||
public void setDestination(Location location, double speed) {
|
||||
if (location != null) {
|
||||
this.location = location;
|
||||
@ -165,16 +199,23 @@ public class CannonDestination implements MVDestination {
|
||||
@Override
|
||||
public String toString() {
|
||||
if (isValid) {
|
||||
return "ca:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY() + "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw() + ":" + this.speed;
|
||||
return "ca:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY()
|
||||
+ "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw() + ":" + this.speed;
|
||||
}
|
||||
return "i:Invalid Destination";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getRequiredPermission() {
|
||||
return "multiverse.access." + this.location.getWorld().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean useSafeTeleporter() {
|
||||
return false;
|
||||
|
@ -66,6 +66,13 @@ public class DestinationFactory {
|
||||
return new InvalidDestination();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a {@link MVDestination}.
|
||||
*
|
||||
* @param c The {@link Class} of the {@link MVDestination} to register.
|
||||
* @param identifier The {@link String}-identifier.
|
||||
* @return True if the class was successfully registered.
|
||||
*/
|
||||
public boolean registerDestinationType(Class<? extends MVDestination> c, String identifier) {
|
||||
if (this.destList.containsKey(identifier)) {
|
||||
return false;
|
||||
@ -79,12 +86,14 @@ public class DestinationFactory {
|
||||
Permission other = this.plugin.getServer().getPluginManager().getPermission("multiverse.teleport.other." + identifier);
|
||||
PermissionTools pt = new PermissionTools(this.plugin);
|
||||
if (self == null) {
|
||||
self = new Permission("multiverse.teleport.self." + identifier, "Permission to teleport yourself for the " + identifier + " destination.", PermissionDefault.OP);
|
||||
self = new Permission("multiverse.teleport.self." + identifier,
|
||||
"Permission to teleport yourself for the " + identifier + " destination.", PermissionDefault.OP);
|
||||
this.plugin.getServer().getPluginManager().addPermission(self);
|
||||
pt.addToParentPerms("multiverse.teleport.self." + identifier);
|
||||
}
|
||||
if (other == null) {
|
||||
other = new Permission("multiverse.teleport.other." + identifier, "Permission to teleport others for the " + identifier + " destination.", PermissionDefault.OP);
|
||||
other = new Permission("multiverse.teleport.other." + identifier,
|
||||
"Permission to teleport others for the " + identifier + " destination.", PermissionDefault.OP);
|
||||
this.plugin.getServer().getPluginManager().addPermission(other);
|
||||
pt.addToParentPerms("multiverse.teleport.other." + identifier);
|
||||
}
|
||||
|
@ -17,20 +17,33 @@ import org.bukkit.util.Vector;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An exact {@link MVDestination}.
|
||||
*/
|
||||
public class ExactDestination implements MVDestination {
|
||||
private final String coordRegex = "(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*),(-?[\\d]+\\.?[\\d]*)";
|
||||
private boolean isValid;
|
||||
private Location location;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "e";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Vector getVelocity() {
|
||||
return new Vector(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isThisType(JavaPlugin plugin, String destination) {
|
||||
if (!(plugin instanceof MultiverseCore)) {
|
||||
@ -70,16 +83,25 @@ public class ExactDestination implements MVDestination {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Location getLocation(Entity e) {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return this.isValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDestination(JavaPlugin plugin, String destination) {
|
||||
if (!(plugin instanceof MultiverseCore)) {
|
||||
@ -139,16 +161,28 @@ public class ExactDestination implements MVDestination {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getType() {
|
||||
return "Exact";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Exact (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ() + ":" + location.getPitch() + ":" + location.getYaw() + ")";
|
||||
return "Exact (" + this.location.getX() + ", " + this.location.getY() + ", " + this.location.getZ()
|
||||
+ ":" + location.getPitch() + ":" + location.getYaw() + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this {@link ExactDestination}.
|
||||
*
|
||||
* @param location The {@link Location}.
|
||||
*/
|
||||
public void setDestination(Location location) {
|
||||
if (location != null) {
|
||||
this.location = location;
|
||||
@ -157,19 +191,29 @@ public class ExactDestination implements MVDestination {
|
||||
this.isValid = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
if (isValid) {
|
||||
return "e:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY() + "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw();
|
||||
return "e:" + location.getWorld().getName() + ":" + location.getX() + "," + location.getY()
|
||||
+ "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw();
|
||||
}
|
||||
return "i:Invalid Destination";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getRequiredPermission() {
|
||||
return "multiverse.access." + this.location.getWorld().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean useSafeTeleporter() {
|
||||
// This is an EXACT destination, don't safely teleport here.
|
||||
|
@ -14,38 +14,62 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* An invalid {@link MVDestination}.
|
||||
*/
|
||||
public class InvalidDestination implements MVDestination {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "i";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isThisType(JavaPlugin plugin, String destination) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Location getLocation(Entity e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDestination(JavaPlugin plugin, String destination) {
|
||||
// Nothing needed, it's invalid.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getType() {
|
||||
return ChatColor.RED + "Invalid Destination";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return ChatColor.RED + "Invalid Destination";
|
||||
@ -56,15 +80,25 @@ public class InvalidDestination implements MVDestination {
|
||||
return "i:Invalid Destination";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getRequiredPermission() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Vector getVelocity() {
|
||||
return new Vector(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean useSafeTeleporter() {
|
||||
return false;
|
||||
|
@ -14,16 +14,25 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* A player-{@link MVDestination}.
|
||||
*/
|
||||
public class PlayerDestination implements MVDestination {
|
||||
private String player;
|
||||
private boolean isValid;
|
||||
private JavaPlugin plugin;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "pl";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isThisType(JavaPlugin plugin, String destination) {
|
||||
String[] items = destination.split(":");
|
||||
@ -36,6 +45,9 @@ public class PlayerDestination implements MVDestination {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Location getLocation(Entity e) {
|
||||
Player p = plugin.getServer().getPlayer(this.player);
|
||||
@ -52,11 +64,17 @@ public class PlayerDestination implements MVDestination {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return this.isValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDestination(JavaPlugin plugin, String destination) {
|
||||
String[] items = destination.split(":");
|
||||
@ -71,11 +89,17 @@ public class PlayerDestination implements MVDestination {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getType() {
|
||||
return "Player";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.player;
|
||||
@ -86,15 +110,25 @@ public class PlayerDestination implements MVDestination {
|
||||
return "pl:" + this.player;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getRequiredPermission() {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Vector getVelocity() {
|
||||
return new Vector(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean useSafeTeleporter() {
|
||||
return true;
|
||||
|
@ -16,17 +16,26 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* A world-{@link MVDestination}.
|
||||
*/
|
||||
public class WorldDestination implements MVDestination {
|
||||
private boolean isValid;
|
||||
private MultiverseWorld world;
|
||||
private float yaw = -1;
|
||||
private String direction = "";
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "w";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isThisType(JavaPlugin plugin, String destination) {
|
||||
String[] items = destination.split(":");
|
||||
@ -48,6 +57,9 @@ public class WorldDestination implements MVDestination {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Location getLocation(Entity e) {
|
||||
Location spawnLoc = getAcurateSpawnLocation(e, this.world);
|
||||
@ -62,15 +74,23 @@ public class WorldDestination implements MVDestination {
|
||||
if (world != null) {
|
||||
return world.getSpawnLocation();
|
||||
} else {
|
||||
// add 0.5 to x and z to center people
|
||||
// (spawn location is stored as int meaning that you would spawn in the corner of a block)
|
||||
return e.getWorld().getSpawnLocation().add(.5, 0, .5);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return this.isValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDestination(JavaPlugin plugin, String destination) {
|
||||
String[] items = destination.split(":");
|
||||
@ -97,11 +117,17 @@ public class WorldDestination implements MVDestination {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getType() {
|
||||
return "World";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.world.getColoredWorldString();
|
||||
@ -115,6 +141,9 @@ public class WorldDestination implements MVDestination {
|
||||
return this.world.getCBWorld().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getRequiredPermission() {
|
||||
// TODO: Potenitally replace spaces wiht tabs for friendlier yaml.
|
||||
@ -122,10 +151,17 @@ public class WorldDestination implements MVDestination {
|
||||
return "multiverse.access." + this.world.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Vector getVelocity() {
|
||||
return new Vector(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean useSafeTeleporter() {
|
||||
return true;
|
||||
|
@ -7,6 +7,24 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.enums;
|
||||
|
||||
/**
|
||||
* A enum containing all actions that can be used to modify world-properties.
|
||||
*/
|
||||
public enum Action {
|
||||
Set, Add, Remove, Clear
|
||||
/**
|
||||
* Setting a property.
|
||||
*/
|
||||
Set,
|
||||
/**
|
||||
* Adding something to a list-property.
|
||||
*/
|
||||
Add,
|
||||
/**
|
||||
* Removing something from a list-property.
|
||||
*/
|
||||
Remove,
|
||||
/**
|
||||
* Clearing a list-property.
|
||||
*/
|
||||
Clear
|
||||
}
|
||||
|
@ -7,6 +7,20 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.enums;
|
||||
|
||||
/**
|
||||
* An enum containing all list-properties.
|
||||
*/
|
||||
public enum AddProperties {
|
||||
worldblacklist, animals, monsters
|
||||
/**
|
||||
* Worlds that people cannot go to from a world.
|
||||
*/
|
||||
worldblacklist,
|
||||
/**
|
||||
* Animal-exceptions.
|
||||
*/
|
||||
animals,
|
||||
/**
|
||||
* Monster-exceptions.
|
||||
*/
|
||||
monsters
|
||||
}
|
||||
|
@ -7,9 +7,56 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.enums;
|
||||
|
||||
/**
|
||||
* An enum containing all config-properties that can be set.
|
||||
*/
|
||||
public enum ConfigProperty {
|
||||
messagecooldown, teleportcooldown, worldnameprefix, enforcegamemodes, enforceaccess, displaypermerrors, debug, firstspawnworld, teleportintercept, firstspawnoverride;
|
||||
/**
|
||||
* How long to leave in between sending a message to the player. (NOT YET IMPLEMENTED)
|
||||
*/
|
||||
messagecooldown,
|
||||
/**
|
||||
* How fast are people allowed to use /MVTP (NOT YET IMPLEMENTED).
|
||||
*/
|
||||
teleportcooldown,
|
||||
/**
|
||||
* Prefix chat-messages with world-names.
|
||||
*/
|
||||
worldnameprefix,
|
||||
/**
|
||||
* If value is set to false, Multiverse will NOT enforce world-gamemodes.
|
||||
*/
|
||||
enforcegamemodes,
|
||||
/**
|
||||
* If value is set to false, Multiverse will NOT enforce world access permissions.
|
||||
*/
|
||||
enforceaccess,
|
||||
/**
|
||||
* Whether users should get detailed information about the permissions they would need.
|
||||
*/
|
||||
displaypermerrors,
|
||||
/**
|
||||
* Debug-information.
|
||||
*/
|
||||
debug,
|
||||
/**
|
||||
* The world new users will spawn in.
|
||||
*/
|
||||
firstspawnworld,
|
||||
/**
|
||||
* Whether Multiverse should intercept teleports.
|
||||
*/
|
||||
teleportintercept,
|
||||
/**
|
||||
* Whether Multiverse should override the first spawn.
|
||||
*/
|
||||
firstspawnoverride;
|
||||
|
||||
/**
|
||||
* Constructs a string containing all values in this enum.
|
||||
*
|
||||
* @return That {@link String}.
|
||||
*/
|
||||
public static String getAllValues() {
|
||||
String buffer = "";
|
||||
for (ConfigProperty c : ConfigProperty.values()) {
|
||||
|
@ -9,22 +9,44 @@ package com.onarandombox.MultiverseCore.enums;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
/**
|
||||
* A regular {@link ChatColor} represented by an english string.
|
||||
*/
|
||||
public enum EnglishChatColor {
|
||||
/*
|
||||
* I know. this is quite ugly.
|
||||
*/
|
||||
/** AQUA. */
|
||||
AQUA("AQUA", ChatColor.AQUA),
|
||||
/** BLACK. */
|
||||
BLACK("BLACK", ChatColor.BLACK),
|
||||
/** BLUE. */
|
||||
BLUE("BLUE", ChatColor.BLUE),
|
||||
/** DARKAQUA. */
|
||||
DARKAQUA("DARKAQUA", ChatColor.DARK_AQUA),
|
||||
/** DARKBLUE. */
|
||||
DARKBLUE("DARKBLUE", ChatColor.DARK_BLUE),
|
||||
/** DARKGRAY. */
|
||||
DARKGRAY("DARKGRAY", ChatColor.DARK_GRAY),
|
||||
/** DARKGREEN. */
|
||||
DARKGREEN("DARKGREEN", ChatColor.DARK_GREEN),
|
||||
/** DARKPURPLE. */
|
||||
DARKPURPLE("DARKPURPLE", ChatColor.DARK_PURPLE),
|
||||
/** DARKRED. */
|
||||
DARKRED("DARKRED", ChatColor.DARK_RED),
|
||||
/** GOLD. */
|
||||
GOLD("GOLD", ChatColor.GOLD),
|
||||
/** GRAY. */
|
||||
GRAY("GRAY", ChatColor.GRAY),
|
||||
/** GREEN. */
|
||||
GREEN("GREEN", ChatColor.GREEN),
|
||||
/** LIGHTPURPLE. */
|
||||
LIGHTPURPLE("LIGHTPURPLE", ChatColor.LIGHT_PURPLE),
|
||||
/** RED. */
|
||||
RED("RED", ChatColor.RED),
|
||||
/** YELLOW. */
|
||||
YELLOW("YELLOW", ChatColor.YELLOW),
|
||||
/** WHITE. */
|
||||
WHITE("WHITE", ChatColor.WHITE);
|
||||
private ChatColor color;
|
||||
private String text;
|
||||
@ -34,14 +56,26 @@ public enum EnglishChatColor {
|
||||
this.text = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the text.
|
||||
* @return The text.
|
||||
*/
|
||||
public String getText() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the color.
|
||||
* @return The color as {@link ChatColor}.
|
||||
*/
|
||||
public ChatColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a string containing all available colors.
|
||||
* @return That {@link String}.
|
||||
*/
|
||||
public static String getAllColors() {
|
||||
String buffer = "";
|
||||
for (EnglishChatColor c : EnglishChatColor.values()) {
|
||||
@ -50,6 +84,11 @@ public enum EnglishChatColor {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an {@link EnglishChatColor} from a {@link String}.
|
||||
* @param text The {@link String}.
|
||||
* @return The {@link EnglishChatColor}.
|
||||
*/
|
||||
public static EnglishChatColor fromString(String text) {
|
||||
if (text != null) {
|
||||
for (EnglishChatColor c : EnglishChatColor.values()) {
|
||||
|
@ -7,6 +7,32 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.enums;
|
||||
|
||||
/**
|
||||
* An enum containing possible teleport-results.
|
||||
*/
|
||||
public enum TeleportResult {
|
||||
FAIL_PERMISSION, FAIL_UNSAFE, FAIL_TOO_POOR, FAIL_INVALID, FAIL_OTHER, SUCCESS
|
||||
/**
|
||||
* Insufficient permissions.
|
||||
*/
|
||||
FAIL_PERMISSION,
|
||||
/**
|
||||
* The teleport was unsafe.
|
||||
*/
|
||||
FAIL_UNSAFE,
|
||||
/**
|
||||
* The player was to poor.
|
||||
*/
|
||||
FAIL_TOO_POOR,
|
||||
/**
|
||||
* The teleport was invalid.
|
||||
*/
|
||||
FAIL_INVALID,
|
||||
/**
|
||||
* Unknown reason.
|
||||
*/
|
||||
FAIL_OTHER,
|
||||
/**
|
||||
* The player was successfully teleported.
|
||||
*/
|
||||
SUCCESS
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
/******************************************************************************
|
||||
* 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MVConfigMigrateEvent extends Event {
|
||||
private static final long serialVersionUID = 3647950355746345397L;
|
||||
private List<String> configsLoaded;
|
||||
|
||||
public MVConfigMigrateEvent(List<String> configsLoaded) {
|
||||
super("MVConfigMigrate");
|
||||
this.configsLoaded = configsLoaded;
|
||||
}
|
||||
|
||||
public void addConfig(String config) {
|
||||
this.configsLoaded.add(config);
|
||||
}
|
||||
|
||||
public List<String> getAllConfigsLoaded() {
|
||||
return this.configsLoaded;
|
||||
}
|
||||
}
|
@ -11,6 +11,9 @@ import org.bukkit.event.Event;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Called when the Multiverse-config should be reloaded.
|
||||
*/
|
||||
public class MVConfigReloadEvent extends Event {
|
||||
private static final long serialVersionUID = 3647950355746345397L;
|
||||
private List<String> configsLoaded;
|
||||
@ -20,10 +23,18 @@ public class MVConfigReloadEvent extends Event {
|
||||
this.configsLoaded = configsLoaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a config to this event.
|
||||
* @param config The config to add.
|
||||
*/
|
||||
public void addConfig(String config) {
|
||||
this.configsLoaded.add(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all loaded configs.
|
||||
* @return A list of all loaded configs.
|
||||
*/
|
||||
public List<String> getAllConfigsLoaded() {
|
||||
return this.configsLoaded;
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* Called
|
||||
*/
|
||||
public class MVRespawnEvent extends Event {
|
||||
private Player player;
|
||||
private Location location;
|
||||
|
@ -8,6 +8,7 @@
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import com.onarandombox.MultiverseCore.api.MVDestination;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -68,6 +69,14 @@ public class MVTeleportEvent extends Event implements Cancellable {
|
||||
return this.dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks if this {@link MVTeleportEvent} is using the {@link SafeTTeleporter}.
|
||||
* @return True if this {@link MVTeleportEvent} is using the {@link SafeTTeleporter}.
|
||||
*/
|
||||
public boolean isUsingSafeTTeleporter() {
|
||||
return useSafeTeleport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.isCancelled;
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* Called when somebody requests version information about Multiverse.
|
||||
*/
|
||||
public class MVVersionEvent extends Event {
|
||||
|
||||
private final StringBuilder versionInfoBuilder;
|
||||
|
||||
public MVVersionEvent(String versionInfo) {
|
||||
super("MVVersionEvent");
|
||||
versionInfoBuilder = new StringBuilder(versionInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version-info currently saved in this event.
|
||||
* @return The version-info.
|
||||
*/
|
||||
public String getVersionInfo() {
|
||||
return versionInfoBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends more version-info to the version-info currently saved in this event.
|
||||
* @param moreVersionInfo The version-info to add. Should end with '\n'.
|
||||
*/
|
||||
public void appendVersionInfo(String moreVersionInfo) {
|
||||
versionInfoBuilder.append(moreVersionInfo);
|
||||
}
|
||||
}
|
@ -9,6 +9,11 @@ package com.onarandombox.MultiverseCore.event;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* Called when somebody requests version information about Multiverse.
|
||||
* @deprecated Use {@link MVVersionEvent} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class MVVersionRequestEvent extends Event {
|
||||
|
||||
private String pasteBinBuffer;
|
||||
@ -18,10 +23,22 @@ public class MVVersionRequestEvent extends Event {
|
||||
this.pasteBinBuffer = pasteBinBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pasteBinBuffer.
|
||||
* @return The pasteBinBuffer.
|
||||
* @deprecated Use {@link MVVersionEvent} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public String getPasteBinBuffer() {
|
||||
return this.pasteBinBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pasteBinBuffer.
|
||||
* @param buffer The new pasteBinBuffer.
|
||||
* @deprecated Use {@link MVVersionEvent} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setPasteBinBuffer(String buffer) {
|
||||
this.pasteBinBuffer = buffer;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import org.bukkit.event.Event;
|
||||
/**
|
||||
* This event is fired *before* the property is actually changed.
|
||||
* <p>
|
||||
* If it is cancled, no change will happen.
|
||||
* If it is cancelled, no change will happen.
|
||||
* <p>
|
||||
* If you want to get the values of the world before the change, query the world.
|
||||
* If you want to get the value being changed, use getProperty()
|
||||
@ -36,14 +36,26 @@ public class MVWorldPropertyChangeEvent extends Event implements Cancellable {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the changed world property's name.
|
||||
* @return The changed world property's name.
|
||||
*/
|
||||
public String getPropertyName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the new value.
|
||||
* @return The new value.
|
||||
*/
|
||||
public String getNewValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the new value.
|
||||
* @param value The new new value.
|
||||
*/
|
||||
public void setNewValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -7,6 +7,9 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.exceptions;
|
||||
|
||||
/**
|
||||
* Thrown when a world-property doesn't exist.
|
||||
*/
|
||||
public class PropertyDoesNotExistException extends Exception {
|
||||
public PropertyDoesNotExistException(String name) {
|
||||
super(name);
|
||||
|
Loading…
Reference in New Issue
Block a user