mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # Bukkit/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
|
||||
package com.intellectualcrafters.plot.api;
|
||||
|
||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||
@ -43,32 +42,40 @@ import java.util.UUID;
|
||||
* @see com.intellectualcrafters.plot.object.Location
|
||||
* @see PlotArea
|
||||
* @see PS
|
||||
* @version 3.3.1
|
||||
>>>>>>> origin/master
|
||||
*/
|
||||
public class PlotAPI {
|
||||
|
||||
/**
|
||||
* Permission that allows for admin access, this permission node will allow the player to use any part of the
|
||||
* plugin, without limitations.
|
||||
* Permission that allows for admin access, this permission node will allow
|
||||
* the player to use any part of the plugin, without limitations.
|
||||
* @deprecated Use C.PERMISSION_ADMIN instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String ADMIN_PERMISSION = C.PERMISSION_ADMIN.s();
|
||||
|
||||
/**
|
||||
* @deprecated Use new PlotAPI() instead
|
||||
* Deprecated, does nothing.
|
||||
* @param plugin not needed
|
||||
* @deprecated Not needed
|
||||
*/
|
||||
@Deprecated
|
||||
public PlotAPI(JavaPlugin plugin) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see PS
|
||||
*
|
||||
* @deprecated Use this class if you just want to do a few simple things.<br>
|
||||
* - It will remain stable for future versions of the plugin
|
||||
* - The PlotPlayer and Plot class should be considered relatively safe
|
||||
* - For more advanced/intensive tasks you should consider using other classes
|
||||
* Default Constructor that does nothing.
|
||||
*
|
||||
* @deprecated Use this class if you just want to do a few simple things
|
||||
* <ul>
|
||||
* <li>It will remain stable for future versions
|
||||
* of the plugin</li>
|
||||
* <li>The PlotPlayer and Plot class should be considered
|
||||
* relatively safe</li>
|
||||
* <li>For more advanced/intensive tasks you should consider
|
||||
* using other classes</li>
|
||||
* </ul>
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
@ -108,6 +115,7 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the PlotSquared configurations file.
|
||||
* @return main configuration
|
||||
*
|
||||
* @see PS#config
|
||||
@ -117,6 +125,7 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotSquared storage file.
|
||||
* @return storage configuration
|
||||
*
|
||||
* @see PS#storage
|
||||
@ -126,8 +135,7 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the main class for this plugin <br> - Contains a lot of fields and methods - not very well organized <br>
|
||||
* Only use this if you really need it
|
||||
* Get the main class for this plugin. Only use this if you really need it.
|
||||
*
|
||||
* @return PlotSquared PlotSquared Main Class
|
||||
*
|
||||
@ -138,12 +146,14 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* ChunkManager class contains several useful methods<br>
|
||||
* - Chunk deletion<br>
|
||||
* - Moving or copying regions<br>
|
||||
* - plot swapping<br>
|
||||
* - Entity tracking<br>
|
||||
* - region regeneration<br>
|
||||
* ChunkManager class contains several useful methods.
|
||||
* <ul>
|
||||
* <li>Chunk deletion</li>
|
||||
* <li>Moving or copying regions</li>
|
||||
* <li>Plot swapping</li>
|
||||
* <li>Entity Tracking</li>
|
||||
* <li>Region Regeneration</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return ChunkManager
|
||||
*
|
||||
@ -162,7 +172,8 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* UUIDWrapper class has basic methods for getting UUIDS (it's recommended to use the UUIDHandler class instead)
|
||||
* UUIDWrapper class has basic methods for getting UUIDS. It's recommended
|
||||
* to use the UUIDHandler class instead.
|
||||
*
|
||||
* @return UUIDWrapper
|
||||
*
|
||||
@ -178,7 +189,7 @@ public class PlotAPI {
|
||||
*
|
||||
* @return FlagManager
|
||||
*
|
||||
* @see com.intellectualcrafters.plot.flag.FlagManager
|
||||
* @deprecated Use {@link FlagManager} directly
|
||||
*/
|
||||
@Deprecated
|
||||
public FlagManager getFlagManager() {
|
||||
@ -187,11 +198,9 @@ public class PlotAPI {
|
||||
|
||||
/**
|
||||
* Do not use this. Instead use MainUtil.[method] in your code.
|
||||
* - Basic plot management stuff
|
||||
*
|
||||
* @return MainUtil
|
||||
*
|
||||
* @see MainUtil
|
||||
* @deprecated Use {@link MainUtil} directly
|
||||
*/
|
||||
@Deprecated
|
||||
public MainUtil getMainUtil() {
|
||||
@ -200,11 +209,11 @@ public class PlotAPI {
|
||||
|
||||
/**
|
||||
* Do not use this. Instead use C.PERMISSION_[method] in your code.
|
||||
* - Basic permission management stuff
|
||||
*
|
||||
* @return Array of strings
|
||||
*
|
||||
* @see com.intellectualcrafters.plot.util.Permissions
|
||||
* @deprecated Use {@link C} to list all the permissions
|
||||
*/
|
||||
@Deprecated
|
||||
public String[] getPermissions() {
|
||||
@ -218,7 +227,8 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* SchematicHandler class contains methods related to pasting, reading and writing schematics
|
||||
* SchematicHandler class contains methods related to pasting, reading
|
||||
* and writing schematics.
|
||||
*
|
||||
* @return SchematicHandler
|
||||
*
|
||||
@ -232,8 +242,7 @@ public class PlotAPI {
|
||||
* Use C.[caption] instead
|
||||
*
|
||||
* @return C
|
||||
*
|
||||
* @see com.intellectualcrafters.plot.config.C
|
||||
* @deprecated Use {@link C}
|
||||
*/
|
||||
@Deprecated
|
||||
public C[] getCaptions() {
|
||||
@ -241,7 +250,8 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plot manager for a world. - Most of these methods can be accessed through the MainUtil
|
||||
* Get the plot manager for a world. Most of these methods can be accessed
|
||||
* through the MainUtil.
|
||||
*
|
||||
* @param world Which manager to get
|
||||
*
|
||||
@ -258,6 +268,11 @@ public class PlotAPI {
|
||||
return getPlotManager(world.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of PlotAreas in the world.
|
||||
* @param world The world to check for plot areas
|
||||
* @return A set of PlotAreas
|
||||
*/
|
||||
public Set<PlotArea> getPlotAreas(World world) {
|
||||
if (world == null) {
|
||||
return new HashSet<>();
|
||||
@ -266,10 +281,10 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plot manager for a world. - Contains useful low level methods for plot merging, clearing, and
|
||||
* tessellation
|
||||
* Get the plot manager for a world. Contains useful low level methods for
|
||||
* plot merging, clearing, and tessellation.
|
||||
*
|
||||
* @param world
|
||||
* @param world The world
|
||||
*
|
||||
* @return PlotManager
|
||||
*
|
||||
@ -291,12 +306,13 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the settings for a world (settings bundled in PlotArea class) - You will need to downcast for the specific
|
||||
* settings a Generator has. e.g. DefaultPlotWorld class implements PlotArea
|
||||
* Get the settings for a world (settings bundled in PlotArea class). You
|
||||
* will need to downcast for the specific settings a Generator has. e.g.
|
||||
* DefaultPlotWorld class implements PlotArea
|
||||
*
|
||||
* @param world (to get settings of)
|
||||
* @param world The World
|
||||
*
|
||||
* @return PlotArea class for that world ! will return null if not a plot world world
|
||||
* @return The {@link PlotArea} for the world or null if not in plotworld
|
||||
*
|
||||
* @see #getPlotAreas(World)
|
||||
* @see com.intellectualcrafters.plot.object.PlotArea
|
||||
@ -310,11 +326,11 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the settings for a world (settings bundled in PlotArea class)
|
||||
* Get the settings for a world.
|
||||
*
|
||||
* @param world (to get settings of)
|
||||
* @param world The world
|
||||
*
|
||||
* @return PlotArea class for that world ! will return null if not a plot world world
|
||||
* @return The {@link PlotArea} for the world or null if not in plotworld
|
||||
*
|
||||
* @see PS#getPlotArea(String, String)
|
||||
* @see com.intellectualcrafters.plot.object.PlotArea
|
||||
@ -340,17 +356,16 @@ public class PlotAPI {
|
||||
* Send a message to a player.
|
||||
*
|
||||
* @param player Player that will receive the message
|
||||
* @param c (Caption)
|
||||
* @param caption Caption
|
||||
*
|
||||
* @see MainUtil#sendMessage(PlotPlayer, C, String...)
|
||||
* com.intellectualcrafters.plot.config.C, String...)
|
||||
*/
|
||||
public void sendMessage(Player player, C c) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), c);
|
||||
public void sendMessage(Player player, C caption) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), caption);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to a player. - Supports color codes
|
||||
* Send a message to a player. Supports color codes.
|
||||
*
|
||||
* @param player Player that will receive the message
|
||||
* @param string The message
|
||||
@ -362,30 +377,30 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to the console. - Supports color codes
|
||||
* Send a message to the console. Supports color codes.
|
||||
*
|
||||
* @param msg Message that should be sent to the console
|
||||
* @param message Message that should be sent to the console
|
||||
*
|
||||
* @see MainUtil#sendConsoleMessage(C, String...)
|
||||
*/
|
||||
public void sendConsoleMessage(String msg) {
|
||||
PS.log(msg);
|
||||
public void sendConsoleMessage(String message) {
|
||||
PS.log(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to the console
|
||||
* Send a message to the console.
|
||||
*
|
||||
* @param c (Caption)
|
||||
* @param caption The caption
|
||||
*
|
||||
* @see #sendConsoleMessage(String)
|
||||
* @see com.intellectualcrafters.plot.config.C
|
||||
*/
|
||||
public void sendConsoleMessage(C c) {
|
||||
sendConsoleMessage(c.s());
|
||||
public void sendConsoleMessage(C caption) {
|
||||
sendConsoleMessage(caption.s());
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a flag for use in plots
|
||||
* Register a flag for use in plots.
|
||||
*
|
||||
* @param flag Flag that should be registered
|
||||
*
|
||||
@ -397,7 +412,7 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* get all the currently registered flags
|
||||
* get all the currently registered flags.
|
||||
*
|
||||
* @return array of Flag[]
|
||||
*
|
||||
@ -412,8 +427,8 @@ public class PlotAPI {
|
||||
* Get a plot based on the ID.
|
||||
*
|
||||
* @param world World in which the plot is located
|
||||
* @param x Plot Location X Co-ord
|
||||
* @param z Plot Location Z Co-ord
|
||||
* @param x The PlotID x coordinate
|
||||
* @param z The PlotID y coordinate
|
||||
*
|
||||
* @return plot, null if ID is wrong
|
||||
*
|
||||
@ -434,17 +449,17 @@ public class PlotAPI {
|
||||
/**
|
||||
* Get a plot based on the location.
|
||||
*
|
||||
* @param l The location that you want to to retrieve the plot from
|
||||
* @param location The location to retrieve the plot from
|
||||
*
|
||||
* @return plot if found, otherwise it creates a temporary plot-
|
||||
* @return plot if found, otherwise it creates a temporary plot
|
||||
*
|
||||
* @see Plot
|
||||
*/
|
||||
public Plot getPlot(Location l) {
|
||||
if (l == null) {
|
||||
public Plot getPlot(Location location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
return BukkitUtil.getLocation(l).getPlot();
|
||||
return BukkitUtil.getLocation(location).getPlot();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -465,7 +480,7 @@ public class PlotAPI {
|
||||
* Check whether or not a player has a plot.
|
||||
*
|
||||
* @param player Player that you want to check for
|
||||
*
|
||||
* @param world The world to check
|
||||
* @return true if player has a plot, false if not.
|
||||
*
|
||||
* @see #getPlots(World, Player, boolean)
|
||||
@ -478,9 +493,10 @@ public class PlotAPI {
|
||||
/**
|
||||
* Get all plots for the player.
|
||||
*
|
||||
* @param world
|
||||
* @param world The world to retrieve plots from
|
||||
* @param player The player to search for
|
||||
* @param justOwner should we just search for owner? Or with rights?
|
||||
* @return An array of plots for the player
|
||||
*/
|
||||
@Deprecated
|
||||
public Plot[] getPlots(World world, Player player, boolean justOwner) {
|
||||
@ -530,9 +546,9 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if plot world
|
||||
* Get if plotworld.
|
||||
*
|
||||
* @param world (to check if plot world)
|
||||
* @param world The world to check
|
||||
*
|
||||
* @return boolean (if plot world or not)
|
||||
*
|
||||
@ -544,9 +560,9 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plot locations
|
||||
* Get plot locations.
|
||||
*
|
||||
* @param p Plot that you want to get the locations for
|
||||
* @param plot Plot to get the locations for
|
||||
*
|
||||
* @return [0] = bottomLc, [1] = topLoc, [2] = home
|
||||
*
|
||||
@ -555,27 +571,30 @@ public class PlotAPI {
|
||||
* @see Plot
|
||||
*/
|
||||
@Deprecated
|
||||
public Location[] getLocations(Plot p) {
|
||||
return new Location[]{BukkitUtil.getLocation(p.getBottom()), BukkitUtil.getLocation(p.getTop()), BukkitUtil.getLocation(p.getHome())};
|
||||
public Location[] getLocations(Plot plot) {
|
||||
Location bukkitBottom = BukkitUtil.getLocation(plot.getCorners()[0]);
|
||||
Location bukkitTop = BukkitUtil.getLocation(plot.getCorners()[1]);
|
||||
Location bukkitHome = BukkitUtil.getLocation(plot.getHome());
|
||||
return new Location[]{bukkitBottom, bukkitTop, bukkitHome};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get home location
|
||||
* Get home location.
|
||||
*
|
||||
* @param p Plot that you want to get the location for
|
||||
* @param plot Plot that you want to get the location for
|
||||
*
|
||||
* @return plot bottom location
|
||||
*
|
||||
* @see Plot
|
||||
*/
|
||||
public Location getHomeLocation(Plot p) {
|
||||
return BukkitUtil.getLocation(p.getHome());
|
||||
public Location getHomeLocation(Plot plot) {
|
||||
return BukkitUtil.getLocation(plot.getHome());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Bottom Location (min, min, min)
|
||||
* Get Bottom Location (min, min, min).
|
||||
*
|
||||
* @param p Plot that you want to get the location for
|
||||
* @param plot Plot that you want to get the location for
|
||||
*
|
||||
* @return plot bottom location
|
||||
*
|
||||
@ -584,14 +603,14 @@ public class PlotAPI {
|
||||
* @see Plot
|
||||
*/
|
||||
@Deprecated
|
||||
public Location getBottomLocation(Plot p) {
|
||||
return BukkitUtil.getLocation(p.getBottom());
|
||||
public Location getBottomLocation(Plot plot) {
|
||||
return BukkitUtil.getLocation(plot.getBottom());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Top Location (max, max, max)
|
||||
* Get Top Location (max, max, max).
|
||||
*
|
||||
* @param p Plot that you want to get the location for
|
||||
* @param plot Plot that you want to get the location for
|
||||
*
|
||||
* @return plot top location
|
||||
*
|
||||
@ -600,12 +619,12 @@ public class PlotAPI {
|
||||
* @see Plot
|
||||
*/
|
||||
@Deprecated
|
||||
public Location getTopLocation(Plot p) {
|
||||
return BukkitUtil.getLocation(p.getTop());
|
||||
public Location getTopLocation(Plot plot) {
|
||||
return BukkitUtil.getLocation(plot.getTop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether or not a player is in a plot
|
||||
* Check whether or not a player is in a plot.
|
||||
*
|
||||
* @param player who we're checking for
|
||||
*
|
||||
@ -617,7 +636,7 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a subcommand
|
||||
* Register a subcommand.
|
||||
* @deprecated Command registration is done on object creation
|
||||
* @param c SubCommand, that we want to register
|
||||
* @see com.intellectualcrafters.plot.commands.SubCommand
|
||||
@ -628,7 +647,7 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotSquared class
|
||||
* Get the PlotSquared class.
|
||||
*
|
||||
* @return PlotSquared Class
|
||||
*
|
||||
@ -639,7 +658,7 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the player plot count
|
||||
* Get the player plot count.
|
||||
*
|
||||
* @param world Specify the world we want to select the plots from
|
||||
* @param player Player, for whom we're getting the plot count
|
||||
@ -655,7 +674,7 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a collection containing the players plots
|
||||
* Get a collection containing the players plots.
|
||||
*
|
||||
* @param world Specify the world we want to select the plots from
|
||||
* @param player Player, for whom we're getting the plots
|
||||
@ -674,9 +693,9 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the numbers of plots, which the player is able to build in
|
||||
* Get the numbers of plots, which the player is able to build in.
|
||||
*
|
||||
* @param player Player, for whom we're getting the plots (trusted, member and owner)
|
||||
* @param player Player, for whom we're getting the plots
|
||||
*
|
||||
* @return the number of allowed plots
|
||||
*
|
||||
@ -687,50 +706,54 @@ public class PlotAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotPlayer for a player<br>
|
||||
* - The PlotPlayer is usually cached and will provide useful functions relating to players
|
||||
* Get the PlotPlayer for a player. The PlotPlayer is usually cached and
|
||||
* will provide useful functions relating to players.
|
||||
*
|
||||
* @see PlotPlayer#wrap(Object)
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
* @param player The player to wrap
|
||||
* @return A PlotPlayer
|
||||
*/
|
||||
public PlotPlayer wrapPlayer(Player player) {
|
||||
return PlotPlayer.wrap(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotPlayer for a UUID (Please note that PlotSquared can be configured to provide different UUIDs than bukkit)
|
||||
* Get the PlotPlayer for a UUID.
|
||||
*
|
||||
* <p><i>Please note that PlotSquared can be configured to provide
|
||||
* different UUIDs than bukkit</i></p>
|
||||
*
|
||||
* @see PlotPlayer#wrap(Object)
|
||||
*
|
||||
* @param uuid
|
||||
* @return
|
||||
* @param uuid The uuid of the player to wrap
|
||||
* @return A PlotPlayer
|
||||
*/
|
||||
public PlotPlayer wrapPlayer(UUID uuid) {
|
||||
return PlotPlayer.wrap(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotPlayer for a username
|
||||
* Get the PlotPlayer for a username.
|
||||
*
|
||||
* @see PlotPlayer#wrap(Object)
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
* @param player The player to wrap
|
||||
* @return The PlotPlayer
|
||||
*/
|
||||
public PlotPlayer wrapPlayer(String player) {
|
||||
return PlotPlayer.wrap(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotPlayer for an offline player<br>
|
||||
* Note that this will work if the player is offline, however not all functionality will work
|
||||
* Get the PlotPlayer for an offline player.
|
||||
* <p>Note that this will work if the player is offline, however not all
|
||||
* functionality will work</p>
|
||||
*
|
||||
* @see PlotPlayer#wrap(Object)
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
* @param player The player to wrap
|
||||
* @return The PlotPlayer
|
||||
*/
|
||||
public PlotPlayer wrapPlayer(OfflinePlayer player) {
|
||||
return PlotPlayer.wrap(player);
|
||||
|
@ -123,7 +123,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
THIS = this;
|
||||
BukkitMain.THIS = this;
|
||||
new PS(this, "Bukkit");
|
||||
}
|
||||
|
||||
@ -131,12 +131,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
public void onDisable() {
|
||||
PS.get().disable();
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
THIS = null;
|
||||
BukkitMain.THIS = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String message) {
|
||||
if (THIS != null) {
|
||||
if (BukkitMain.THIS != null) {
|
||||
try {
|
||||
message = C.color(message);
|
||||
if (!Settings.CONSOLE_COLOR) {
|
||||
@ -153,7 +153,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
if (THIS != null) {
|
||||
if (BukkitMain.THIS != null) {
|
||||
onDisable();
|
||||
}
|
||||
}
|
||||
@ -170,11 +170,11 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
@Override
|
||||
public void registerCommands() {
|
||||
BukkitCommand bcmd = new BukkitCommand();
|
||||
BukkitCommand bukkitCommand = new BukkitCommand();
|
||||
PluginCommand plotCommand = getCommand("plots");
|
||||
plotCommand.setExecutor(bcmd);
|
||||
plotCommand.setExecutor(bukkitCommand);
|
||||
plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot"));
|
||||
plotCommand.setTabCompleter(bcmd);
|
||||
plotCommand.setTabCompleter(bukkitCommand);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -224,10 +224,9 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
case LIGHTNING:
|
||||
case WITHER_SKULL:
|
||||
case UNKNOWN:
|
||||
case PLAYER: {
|
||||
// non moving / unremovable
|
||||
case PLAYER:
|
||||
// non moving / unmovable
|
||||
continue;
|
||||
}
|
||||
case THROWN_EXP_BOTTLE:
|
||||
case SPLASH_POTION:
|
||||
case SNOWBALL:
|
||||
@ -235,15 +234,13 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
case SPECTRAL_ARROW:
|
||||
case TIPPED_ARROW:
|
||||
case ENDER_PEARL:
|
||||
case ARROW: {
|
||||
case ARROW:
|
||||
// managed elsewhere | projectile
|
||||
continue;
|
||||
}
|
||||
case ARMOR_STAND:
|
||||
case ITEM_FRAME:
|
||||
case PAINTING: {
|
||||
case PAINTING:
|
||||
// TEMPORARILY CLASSIFY AS VEHICLE
|
||||
}
|
||||
case MINECART:
|
||||
case MINECART_CHEST:
|
||||
case MINECART_COMMAND:
|
||||
@ -278,15 +275,13 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
case SMALL_FIREBALL:
|
||||
case FIREBALL:
|
||||
case DRAGON_FIREBALL:
|
||||
case DROPPED_ITEM: {
|
||||
case DROPPED_ITEM:
|
||||
// dropped item
|
||||
continue;
|
||||
}
|
||||
case PRIMED_TNT:
|
||||
case FALLING_BLOCK: {
|
||||
case FALLING_BLOCK:
|
||||
// managed elsewhere
|
||||
continue;
|
||||
}
|
||||
case BAT:
|
||||
case BLAZE:
|
||||
case CAVE_SPIDER:
|
||||
@ -320,7 +315,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
case WOLF:
|
||||
case ZOMBIE:
|
||||
case SHULKER:
|
||||
default: {
|
||||
default:
|
||||
if (!Settings.KILL_ROAD_MOBS) {
|
||||
continue;
|
||||
}
|
||||
@ -332,7 +327,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
@ -383,7 +377,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
@Override
|
||||
public boolean initWorldEdit() {
|
||||
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
|
||||
BukkitMain.worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
getServer().getPluginManager().registerEvents(new WEListener(), this);
|
||||
return true;
|
||||
}
|
||||
|
@ -107,9 +107,9 @@ public class DebugUUID extends SubCommand {
|
||||
worlds.add("world");
|
||||
HashSet<UUID> uuids = new HashSet<>();
|
||||
HashSet<String> names = new HashSet<>();
|
||||
for (String worldname : worlds) {
|
||||
File playerdataFolder = new File(worldname + File.separator + "playerdata");
|
||||
String[] dat = playerdataFolder.list(new FilenameFilter() {
|
||||
for (String worldName : worlds) {
|
||||
File playerDataFolder = new File(worldName + File.separator + "playerdata");
|
||||
String[] dat = playerDataFolder.list(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File f, String s) {
|
||||
return s.endsWith(".dat");
|
||||
@ -126,7 +126,7 @@ public class DebugUUID extends SubCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
File playersFolder = new File(worldname + File.separator + "players");
|
||||
File playersFolder = new File(worldName + File.separator + "players");
|
||||
dat = playersFolder.list(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File f, String s) {
|
||||
@ -286,7 +286,7 @@ public class DebugUUID extends SubCommand {
|
||||
try {
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
} catch (IOException e) {
|
||||
MainUtil.sendMessage(player, "Could not save configuration. It will need to be manuall set!");
|
||||
MainUtil.sendMessage(player, "Could not save configuration. It will need to be manual set!");
|
||||
}
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Populating tables");
|
||||
|
@ -55,16 +55,16 @@ abstract class APlotMeConnector {
|
||||
public Location getPlotTopLocAbs(int path, int plot, PlotId plotid) {
|
||||
int px = plotid.x;
|
||||
int pz = plotid.y;
|
||||
int x = (px * (path + plot)) - (int) Math.floor(path / 2) - 1;
|
||||
int z = (pz * (path + plot)) - (int) Math.floor(path / 2) - 1;
|
||||
int x = px * (path + plot) - (int) Math.floor(path / 2) - 1;
|
||||
int z = pz * (path + plot) - (int) Math.floor(path / 2) - 1;
|
||||
return new Location(null, x, 256, z);
|
||||
}
|
||||
|
||||
public Location getPlotBottomLocAbs(int path, int plot, PlotId plotid) {
|
||||
int px = plotid.x;
|
||||
int pz = plotid.y;
|
||||
int x = (px * (path + plot)) - plot - (int) Math.floor(path / 2) - 1;
|
||||
int z = (pz * (path + plot)) - plot - (int) Math.floor(path / 2) - 1;
|
||||
int x = px * (path + plot) - plot - (int) Math.floor(path / 2) - 1;
|
||||
int z = pz * (path + plot) - plot - (int) Math.floor(path / 2) - 1;
|
||||
return new Location(null, x, 1, z);
|
||||
}
|
||||
|
||||
|
@ -154,8 +154,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
for (Entry<String, HashMap<PlotId, boolean[]>> entry : merges.entrySet()) {
|
||||
String world = entry.getKey();
|
||||
for (Entry<PlotId, boolean[]> entry2 : entry.getValue().entrySet()) {
|
||||
HashMap<PlotId, Plot> newplots = plots.get(world);
|
||||
Plot plot = newplots.get(entry2.getKey());
|
||||
HashMap<PlotId, Plot> newPlots = plots.get(world);
|
||||
Plot plot = newPlots.get(entry2.getKey());
|
||||
if (plot != null) {
|
||||
plot.setMerged(entry2.getValue());
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ public class LikePlotMeConverter {
|
||||
}
|
||||
|
||||
public static String getWorld(String world) {
|
||||
for (World newworld : Bukkit.getWorlds()) {
|
||||
if (newworld.getName().equalsIgnoreCase(world)) {
|
||||
return newworld.getName();
|
||||
for (World newWorld : Bukkit.getWorlds()) {
|
||||
if (newWorld.getName().equalsIgnoreCase(world)) {
|
||||
return newWorld.getName();
|
||||
}
|
||||
}
|
||||
return world;
|
||||
@ -205,11 +205,11 @@ public class LikePlotMeConverter {
|
||||
PS.get().config.set("worlds." + world + ".road.height", pathheight);
|
||||
PS.get().config.set("worlds." + world + ".wall.height", pathheight);
|
||||
PS.get().config.set("worlds." + world + ".plot.height", pathheight);
|
||||
Integer plotsize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
|
||||
if (plotsize == 0) {
|
||||
plotsize = 32;
|
||||
Integer plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
|
||||
if (plotSize == 0) {
|
||||
plotSize = 32;
|
||||
}
|
||||
PS.get().config.set("worlds." + world + ".plot.size", plotsize);
|
||||
PS.get().config.set("worlds." + world + ".plot.size", plotSize);
|
||||
String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44"); //
|
||||
PS.get().config.set("worlds." + world + ".wall.block", wallblock);
|
||||
String floor = plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
|
||||
@ -310,10 +310,10 @@ public class LikePlotMeConverter {
|
||||
.isEnabled()) {
|
||||
mw = true;
|
||||
}
|
||||
for (String worldname : worlds) {
|
||||
World world = Bukkit.getWorld(getWorld(worldname));
|
||||
for (String worldName : worlds) {
|
||||
World world = Bukkit.getWorld(getWorld(worldName));
|
||||
if (world == null) {
|
||||
sendMessage("&cInvalid world in PlotMe configuration: " + worldname);
|
||||
sendMessage("&cInvalid world in PlotMe configuration: " + worldName);
|
||||
}
|
||||
String actualWorldName = world.getName();
|
||||
sendMessage("Reloading generator for world: '" + actualWorldName + "'...");
|
||||
@ -344,8 +344,8 @@ public class LikePlotMeConverter {
|
||||
// Load using Bukkit API
|
||||
// - User must set generator manually
|
||||
Bukkit.getServer().unloadWorld(world, true);
|
||||
World myworld = WorldCreator.name(actualWorldName).generator(new BukkitPlotGenerator(new HybridGen())).createWorld();
|
||||
myworld.save();
|
||||
World myWorld = WorldCreator.name(actualWorldName).generator(new BukkitPlotGenerator(new HybridGen())).createWorld();
|
||||
myWorld.save();
|
||||
}
|
||||
}
|
||||
} catch (CommandException e) {
|
||||
|
@ -111,8 +111,8 @@ public class ChunkListener implements Listener {
|
||||
if (!PS.get().hasPlotArea(name)) {
|
||||
continue;
|
||||
}
|
||||
boolean autosave = world.isAutoSave();
|
||||
if (autosave) {
|
||||
boolean autoSave = world.isAutoSave();
|
||||
if (autoSave) {
|
||||
world.setAutoSave(false);
|
||||
}
|
||||
HashMap<ChunkLoc, Integer> map = players.get(name);
|
||||
@ -142,7 +142,7 @@ public class ChunkListener implements Listener {
|
||||
time = 1;
|
||||
}
|
||||
}
|
||||
if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE && autosave) {
|
||||
if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE && autoSave) {
|
||||
world.setAutoSave(true);
|
||||
}
|
||||
}
|
||||
|
@ -636,22 +636,22 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBigBoom(EntityExplodeEvent event) {
|
||||
Location loc = BukkitUtil.getLocation(event.getLocation());
|
||||
PlotArea area = loc.getPlotArea();
|
||||
Location location = BukkitUtil.getLocation(event.getLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
if (!PS.get().hasPlotArea(loc.getWorld())) {
|
||||
if (!PS.get().hasPlotArea(location.getWorld())) {
|
||||
return;
|
||||
}
|
||||
Iterator<Block> iter = event.blockList().iterator();
|
||||
while (iter.hasNext()) {
|
||||
iter.next();
|
||||
if (loc.getPlotArea() != null) {
|
||||
iter.remove();
|
||||
Iterator<Block> iterator = event.blockList().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next();
|
||||
if (location.getPlotArea() != null) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getOwnedPlot(loc);
|
||||
Plot plot = area.getOwnedPlot(location);
|
||||
if (plot != null) {
|
||||
if (FlagManager.isPlotFlagTrue(plot, "explosion")) {
|
||||
List<MetadataValue> meta = event.getEntity().getMetadata("plot");
|
||||
@ -672,12 +672,12 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
this.lastRadius = 0;
|
||||
}
|
||||
Iterator<Block> iter = event.blockList().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Block b = iter.next();
|
||||
loc = BukkitUtil.getLocation(b.getLocation());
|
||||
if (!area.contains(loc.getX(), loc.getZ()) || !origin.equals(area.getOwnedPlot(loc))) {
|
||||
iter.remove();
|
||||
Iterator<Block> iterator = event.blockList().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Block block = iterator.next();
|
||||
location = BukkitUtil.getLocation(block.getLocation());
|
||||
if (!area.contains(location.getX(), location.getZ()) || !origin.equals(area.getOwnedPlot(location))) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -1267,8 +1267,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
Block block = event.getBlock();
|
||||
World world = block.getWorld();
|
||||
String worldname = world.getName();
|
||||
if (!PS.get().hasPlotArea(worldname)) {
|
||||
String worldName = world.getName();
|
||||
if (!PS.get().hasPlotArea(worldName)) {
|
||||
return;
|
||||
}
|
||||
Location loc = BukkitUtil.getLocation(block.getLocation());
|
||||
@ -1382,7 +1382,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
case LIGHTNING:
|
||||
case WITHER_SKULL:
|
||||
case UNKNOWN:
|
||||
// non moving / unremovable
|
||||
// non moving / unmovable
|
||||
return checkEntity(plot, "entity-cap");
|
||||
case ITEM_FRAME:
|
||||
case PAINTING:
|
||||
@ -1540,17 +1540,17 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
|
||||
} else if (event.getIgnitingBlock() != null) {
|
||||
Block igniter = event.getIgnitingBlock();
|
||||
Block ignitingBlock = event.getIgnitingBlock();
|
||||
if (igniteCause == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL) {
|
||||
if (plot == null || !FlagManager.isPlotFlagTrue(plot, "block-ignition")) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (BukkitUtil.getLocation(igniter.getLocation()).getPlot() == null) {
|
||||
if (BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot() == null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (!BukkitUtil.getLocation(igniter.getLocation()).getPlot().equals(plot)) {
|
||||
if (!BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot().equals(plot)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -1560,11 +1560,11 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (BukkitUtil.getLocation(igniter.getLocation()).getPlot() == null) {
|
||||
if (BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot() == null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (!BukkitUtil.getLocation(igniter.getLocation()).getPlot().equals(plot)) {
|
||||
if (!BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot().equals(plot)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -25,11 +25,11 @@ public class PlayerEvents183 implements Listener {
|
||||
}
|
||||
PlotArea area = loc.getPlotArea();
|
||||
if (area == null) {
|
||||
Iterator<Block> iter = event.blockList().iterator();
|
||||
while (iter.hasNext()) {
|
||||
loc = BukkitUtil.getLocation(iter.next().getLocation());
|
||||
Iterator<Block> iterator = event.blockList().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
loc = BukkitUtil.getLocation(iterator.next().getLocation());
|
||||
if (loc.getPlotArea() != null) {
|
||||
iter.remove();
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -38,11 +38,11 @@ public class PlayerEvents183 implements Listener {
|
||||
if (plot == null || !FlagManager.isPlotFlagTrue(plot, "explosion")) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
Iterator<Block> iter = event.blockList().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Block b = iter.next();
|
||||
Iterator<Block> iterator = event.blockList().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Block b = iterator.next();
|
||||
if (!plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(b.getLocation())))) {
|
||||
iter.remove();
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,6 @@ import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
|
||||
import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -26,6 +22,11 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlotPlusListener extends PlotListener implements Listener {
|
||||
|
||||
private static final HashMap<String, Interval> feedRunnable = new HashMap<>();
|
||||
@ -36,15 +37,15 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!healRunnable.isEmpty()) {
|
||||
for (Iterator<Entry<String, Interval>> iter = healRunnable.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Entry<String, Interval> entry = iter.next();
|
||||
for (Iterator<Entry<String, Interval>> iterator = healRunnable.entrySet().iterator(); iterator.hasNext(); ) {
|
||||
Entry<String, Interval> entry = iterator.next();
|
||||
Interval value = entry.getValue();
|
||||
++value.count;
|
||||
if (value.count == value.interval) {
|
||||
value.count = 0;
|
||||
Player player = Bukkit.getPlayer(entry.getKey());
|
||||
if (player == null) {
|
||||
iter.remove();
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
double level = player.getHealth();
|
||||
@ -55,15 +56,15 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
if (!feedRunnable.isEmpty()) {
|
||||
for (Iterator<Entry<String, Interval>> iter = feedRunnable.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Entry<String, Interval> entry = iter.next();
|
||||
for (Iterator<Entry<String, Interval>> iterator = feedRunnable.entrySet().iterator(); iterator.hasNext(); ) {
|
||||
Entry<String, Interval> entry = iterator.next();
|
||||
Interval value = entry.getValue();
|
||||
++value.count;
|
||||
if (value.count == value.interval) {
|
||||
value.count = 0;
|
||||
Player player = Bukkit.getPlayer(entry.getKey());
|
||||
if (player == null) {
|
||||
iter.remove();
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
int level = player.getFoodLevel();
|
||||
|
@ -56,7 +56,7 @@ public class EntityWrapper {
|
||||
private ArmorStandStats stand;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public EntityWrapper(org.bukkit.entity.Entity entity, short depth) {
|
||||
public EntityWrapper(Entity entity, short depth) {
|
||||
this.hash = entity.getEntityId();
|
||||
this.depth = depth;
|
||||
Location loc = entity.getLocation();
|
||||
@ -113,21 +113,24 @@ public class EntityWrapper {
|
||||
case THROWN_EXP_BOTTLE:
|
||||
case WEATHER:
|
||||
case WITHER_SKULL:
|
||||
case UNKNOWN: {
|
||||
case UNKNOWN:
|
||||
case TIPPED_ARROW:
|
||||
case SPECTRAL_ARROW:
|
||||
case SHULKER_BULLET:
|
||||
case DRAGON_FIREBALL:
|
||||
case LINGERING_POTION:
|
||||
case AREA_EFFECT_CLOUD:
|
||||
// Do this stuff later
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
default:
|
||||
PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
||||
return;
|
||||
}
|
||||
// MISC //
|
||||
case DROPPED_ITEM: {
|
||||
case DROPPED_ITEM:
|
||||
Item item = (Item) entity;
|
||||
this.stack = item.getItemStack();
|
||||
return;
|
||||
}
|
||||
case ITEM_FRAME: {
|
||||
case ITEM_FRAME:
|
||||
ItemFrame itemframe = (ItemFrame) entity;
|
||||
this.x = Math.floor(this.x);
|
||||
this.y = Math.floor(this.y);
|
||||
@ -135,8 +138,7 @@ public class EntityWrapper {
|
||||
this.dataByte = getOrdinal(Rotation.values(), itemframe.getRotation());
|
||||
this.stack = itemframe.getItem().clone();
|
||||
return;
|
||||
}
|
||||
case PAINTING: {
|
||||
case PAINTING:
|
||||
Painting painting = (Painting) entity;
|
||||
this.x = Math.floor(this.x);
|
||||
this.y = Math.floor(this.y);
|
||||
@ -144,23 +146,21 @@ public class EntityWrapper {
|
||||
Art a = painting.getArt();
|
||||
this.dataByte = getOrdinal(BlockFace.values(), painting.getFacing());
|
||||
int h = a.getBlockHeight();
|
||||
if ((h % 2) == 0) {
|
||||
if (h % 2 == 0) {
|
||||
this.y -= 1;
|
||||
}
|
||||
this.dataString = a.name();
|
||||
return;
|
||||
}
|
||||
// END MISC //
|
||||
// INVENTORY HOLDER //
|
||||
case MINECART_CHEST:
|
||||
case MINECART_HOPPER: {
|
||||
case MINECART_HOPPER:
|
||||
storeInventory((InventoryHolder) entity);
|
||||
return;
|
||||
}
|
||||
// START LIVING ENTITY //
|
||||
// START AGEABLE //
|
||||
// START TAMEABLE //
|
||||
case HORSE: {
|
||||
case HORSE:
|
||||
Horse horse = (Horse) entity;
|
||||
this.horse = new HorseStats();
|
||||
this.horse.jump = horse.getJumpStrength();
|
||||
@ -173,52 +173,45 @@ public class EntityWrapper {
|
||||
storeLiving((LivingEntity) entity);
|
||||
storeInventory((InventoryHolder) entity);
|
||||
return;
|
||||
}
|
||||
// END INVENTORY HOLDER //
|
||||
case WOLF:
|
||||
case OCELOT: {
|
||||
case OCELOT:
|
||||
storeTameable((Tameable) entity);
|
||||
storeAgeable((Ageable) entity);
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
// END AMEABLE //
|
||||
case SHEEP: {
|
||||
// END TAMEABLE //
|
||||
case SHEEP:
|
||||
Sheep sheep = (Sheep) entity;
|
||||
this.dataByte = (byte) (sheep.isSheared() ? 1 : 0);
|
||||
this.dataByte2 = sheep.getColor().getDyeData();
|
||||
storeAgeable((Ageable) entity);
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
case VILLAGER:
|
||||
case CHICKEN:
|
||||
case COW:
|
||||
case MUSHROOM_COW:
|
||||
case PIG: {
|
||||
case PIG:
|
||||
storeAgeable((Ageable) entity);
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
// END AGEABLE //
|
||||
case RABBIT: { // NEW
|
||||
case RABBIT: // NEW
|
||||
this.dataByte = getOrdinal(Type.values(), ((Rabbit) entity).getRabbitType());
|
||||
storeAgeable((Ageable) entity);
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
case GUARDIAN: { // NEW
|
||||
// END AGEABLE //
|
||||
case GUARDIAN: // NEW
|
||||
this.dataByte = (byte) (((Guardian) entity).isElder() ? 1 : 0);
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
case SKELETON: { // NEW
|
||||
case SKELETON: // NEW
|
||||
this.dataByte = (byte) ((Skeleton) entity).getSkeletonType().getId();
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
case ARMOR_STAND: { // NEW
|
||||
// CHECK positions
|
||||
case ARMOR_STAND: // NEW
|
||||
// CHECK positions
|
||||
ArmorStand stand = (ArmorStand) entity;
|
||||
this.inventory = new ItemStack[]{stand.getItemInHand().clone(), stand.getHelmet().clone(), stand.getChestplate().clone(),
|
||||
stand.getLeggings().clone(), stand.getBoots().clone()};
|
||||
@ -271,7 +264,6 @@ public class EntityWrapper {
|
||||
this.stand.small = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case ENDERMITE: // NEW
|
||||
case BAT:
|
||||
case ENDER_DRAGON:
|
||||
@ -289,12 +281,11 @@ public class EntityWrapper {
|
||||
case ENDERMAN:
|
||||
case CREEPER:
|
||||
case BLAZE:
|
||||
case SHULKER:
|
||||
case SNOWMAN:
|
||||
case IRON_GOLEM: {
|
||||
case IRON_GOLEM:
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
// END LIVING //
|
||||
// END LIVING //
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,7 +309,7 @@ public class EntityWrapper {
|
||||
entity.setCustomName(this.lived.name);
|
||||
entity.setCustomNameVisible(this.lived.visible);
|
||||
}
|
||||
if ((this.lived.potions != null) && !this.lived.potions.isEmpty()) {
|
||||
if (this.lived.potions != null && !this.lived.potions.isEmpty()) {
|
||||
entity.addPotionEffects(this.lived.potions);
|
||||
}
|
||||
entity.setRemainingAir(this.lived.air);
|
||||
@ -413,21 +404,17 @@ public class EntityWrapper {
|
||||
}
|
||||
Entity entity;
|
||||
switch (this.type) {
|
||||
case DROPPED_ITEM: {
|
||||
case DROPPED_ITEM:
|
||||
return world.dropItem(loc, this.stack);
|
||||
}
|
||||
case PLAYER:
|
||||
case LEASH_HITCH: {
|
||||
case LEASH_HITCH:
|
||||
return null;
|
||||
}
|
||||
case ITEM_FRAME: {
|
||||
case ITEM_FRAME:
|
||||
entity = world.spawn(loc, ItemFrame.class);
|
||||
break;
|
||||
}
|
||||
case PAINTING: {
|
||||
case PAINTING:
|
||||
entity = world.spawn(loc, Painting.class);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
entity = world.spawnEntity(loc, this.type);
|
||||
break;
|
||||
@ -483,38 +470,33 @@ public class EntityWrapper {
|
||||
case WEATHER:
|
||||
case WITHER_SKULL:
|
||||
case MINECART_FURNACE:
|
||||
case UNKNOWN: {
|
||||
case UNKNOWN:
|
||||
// Do this stuff later
|
||||
return entity;
|
||||
}
|
||||
default: {
|
||||
default:
|
||||
PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
||||
return entity;
|
||||
}
|
||||
// MISC //
|
||||
case ITEM_FRAME: {
|
||||
case ITEM_FRAME:
|
||||
ItemFrame itemframe = (ItemFrame) entity;
|
||||
itemframe.setRotation(Rotation.values()[this.dataByte]);
|
||||
itemframe.setItem(this.stack);
|
||||
return entity;
|
||||
}
|
||||
case PAINTING: {
|
||||
case PAINTING:
|
||||
Painting painting = (Painting) entity;
|
||||
painting.setFacingDirection(BlockFace.values()[this.dataByte], true);
|
||||
painting.setArt(Art.getByName(this.dataString), true);
|
||||
return entity;
|
||||
}
|
||||
// END MISC //
|
||||
// INVENTORY HOLDER //
|
||||
case MINECART_CHEST:
|
||||
case MINECART_HOPPER: {
|
||||
case MINECART_HOPPER:
|
||||
restoreInventory((InventoryHolder) entity);
|
||||
return entity;
|
||||
}
|
||||
// START LIVING ENTITY //
|
||||
// START AGEABLE //
|
||||
// START TAMEABLE //
|
||||
case HORSE: {
|
||||
case HORSE:
|
||||
Horse horse = (Horse) entity;
|
||||
horse.setJumpStrength(this.horse.jump);
|
||||
horse.setCarryingChest(this.horse.chest);
|
||||
@ -526,17 +508,15 @@ public class EntityWrapper {
|
||||
restoreLiving((LivingEntity) entity);
|
||||
restoreInventory((InventoryHolder) entity);
|
||||
return entity;
|
||||
}
|
||||
// END INVENTORY HOLDER //
|
||||
case WOLF:
|
||||
case OCELOT: {
|
||||
case OCELOT:
|
||||
restoreTameable((Tameable) entity);
|
||||
restoreAgeable((Ageable) entity);
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
}
|
||||
// END AGEABLE //
|
||||
case SHEEP: {
|
||||
case SHEEP:
|
||||
Sheep sheep = (Sheep) entity;
|
||||
if (this.dataByte == 1) {
|
||||
sheep.setSheared(true);
|
||||
@ -547,41 +527,36 @@ public class EntityWrapper {
|
||||
restoreAgeable((Ageable) entity);
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
}
|
||||
case VILLAGER:
|
||||
case CHICKEN:
|
||||
case COW:
|
||||
case MUSHROOM_COW:
|
||||
case PIG: {
|
||||
case PIG:
|
||||
restoreAgeable((Ageable) entity);
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
}
|
||||
// END AGEABLE //
|
||||
case RABBIT: { // NEW
|
||||
case RABBIT: // NEW
|
||||
if (this.dataByte != 0) {
|
||||
((Rabbit) entity).setRabbitType(Type.values()[this.dataByte]);
|
||||
}
|
||||
restoreAgeable((Ageable) entity);
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
}
|
||||
case GUARDIAN: { // NEW
|
||||
case GUARDIAN: // NEW
|
||||
if (this.dataByte != 0) {
|
||||
((Guardian) entity).setElder(true);
|
||||
}
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
}
|
||||
case SKELETON: { // NEW
|
||||
case SKELETON: // NEW
|
||||
if (this.dataByte != 0) {
|
||||
((Skeleton) entity).setSkeletonType(SkeletonType.values()[this.dataByte]);
|
||||
}
|
||||
storeLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
}
|
||||
case ARMOR_STAND: { // NEW
|
||||
// CHECK positions
|
||||
case ARMOR_STAND: // NEW
|
||||
// CHECK positions
|
||||
ArmorStand stand = (ArmorStand) entity;
|
||||
if (this.inventory[0] != null) {
|
||||
stand.setItemInHand(this.inventory[0]);
|
||||
@ -598,27 +573,27 @@ public class EntityWrapper {
|
||||
if (this.inventory[4] != null) {
|
||||
stand.setBoots(this.inventory[4]);
|
||||
}
|
||||
if ((this.stand.head[0] != 0) || (this.stand.head[1] != 0) || (this.stand.head[2] != 0)) {
|
||||
if (this.stand.head[0] != 0 || this.stand.head[1] != 0 || this.stand.head[2] != 0) {
|
||||
EulerAngle pose = new EulerAngle(this.stand.head[0], this.stand.head[1], this.stand.head[2]);
|
||||
stand.setHeadPose(pose);
|
||||
}
|
||||
if ((this.stand.body[0] != 0) || (this.stand.body[1] != 0) || (this.stand.body[2] != 0)) {
|
||||
if (this.stand.body[0] != 0 || this.stand.body[1] != 0 || this.stand.body[2] != 0) {
|
||||
EulerAngle pose = new EulerAngle(this.stand.body[0], this.stand.body[1], this.stand.body[2]);
|
||||
stand.setBodyPose(pose);
|
||||
}
|
||||
if ((this.stand.leftLeg[0] != 0) || (this.stand.leftLeg[1] != 0) || (this.stand.leftLeg[2] != 0)) {
|
||||
if (this.stand.leftLeg[0] != 0 || this.stand.leftLeg[1] != 0 || this.stand.leftLeg[2] != 0) {
|
||||
EulerAngle pose = new EulerAngle(this.stand.leftLeg[0], this.stand.leftLeg[1], this.stand.leftLeg[2]);
|
||||
stand.setLeftLegPose(pose);
|
||||
}
|
||||
if ((this.stand.rightLeg[0] != 0) || (this.stand.rightLeg[1] != 0) || (this.stand.rightLeg[2] != 0)) {
|
||||
if (this.stand.rightLeg[0] != 0 || this.stand.rightLeg[1] != 0 || this.stand.rightLeg[2] != 0) {
|
||||
EulerAngle pose = new EulerAngle(this.stand.rightLeg[0], this.stand.rightLeg[1], this.stand.rightLeg[2]);
|
||||
stand.setRightLegPose(pose);
|
||||
}
|
||||
if ((this.stand.leftArm[0] != 0) || (this.stand.leftArm[1] != 0) || (this.stand.leftArm[2] != 0)) {
|
||||
if (this.stand.leftArm[0] != 0 || this.stand.leftArm[1] != 0 || this.stand.leftArm[2] != 0) {
|
||||
EulerAngle pose = new EulerAngle(this.stand.leftArm[0], this.stand.leftArm[1], this.stand.leftArm[2]);
|
||||
stand.setLeftArmPose(pose);
|
||||
}
|
||||
if ((this.stand.rightArm[0] != 0) || (this.stand.rightArm[1] != 0) || (this.stand.rightArm[2] != 0)) {
|
||||
if (this.stand.rightArm[0] != 0 || this.stand.rightArm[1] != 0 || this.stand.rightArm[2] != 0) {
|
||||
EulerAngle pose = new EulerAngle(this.stand.rightArm[0], this.stand.rightArm[1], this.stand.rightArm[2]);
|
||||
stand.setRightArmPose(pose);
|
||||
}
|
||||
@ -639,7 +614,6 @@ public class EntityWrapper {
|
||||
}
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
}
|
||||
case ENDERMITE: // NEW
|
||||
case BAT:
|
||||
case ENDER_DRAGON:
|
||||
@ -658,10 +632,9 @@ public class EntityWrapper {
|
||||
case CREEPER:
|
||||
case BLAZE:
|
||||
case SNOWMAN:
|
||||
case IRON_GOLEM: {
|
||||
case IRON_GOLEM:
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
}
|
||||
// END LIVING //
|
||||
}
|
||||
}
|
||||
|
@ -275,9 +275,9 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkModified(String worldname, int x1, int x2, int y1, int y2, int z1, int z2,
|
||||
public int checkModified(String worldName, int x1, int x2, int y1, int y2, int z1, int z2,
|
||||
PlotBlock[] blocks) {
|
||||
World world = BukkitUtil.getWorld(worldname);
|
||||
World world = BukkitUtil.getWorld(worldName);
|
||||
int count = 0;
|
||||
for (int y = y1; y <= y2; y++) {
|
||||
for (int x = x1; x <= x2; x++) {
|
||||
@ -301,8 +301,8 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get_ey(String worldname, int sx, int ex, int sz, int ez, int sy) {
|
||||
World world = BukkitUtil.getWorld(worldname);
|
||||
public int get_ey(String worldName, int sx, int ex, int sz, int ez, int sy) {
|
||||
World world = BukkitUtil.getWorld(worldName);
|
||||
int maxY = world.getMaxHeight();
|
||||
int ey = sy;
|
||||
for (int x = sx; x <= ex; x++) {
|
||||
|
@ -26,7 +26,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@ -45,9 +44,9 @@ public class BukkitSchematicHandler extends SchematicHandler {
|
||||
final Location bot = corners[0];
|
||||
Location top = corners[1];
|
||||
|
||||
final int width = (top.getX() - bot.getX()) + 1;
|
||||
int height = (top.getY() - bot.getY()) + 1;
|
||||
final int length = (top.getZ() - bot.getZ()) + 1;
|
||||
final int width = top.getX() - bot.getX() + 1;
|
||||
int height = top.getY() - bot.getY() + 1;
|
||||
final int length = top.getZ() - bot.getZ() + 1;
|
||||
// Main Schematic tag
|
||||
final HashMap<String, Tag> schematic = new HashMap<>();
|
||||
schematic.put("Width", new ShortTag("Width", (short) width));
|
||||
@ -114,7 +113,7 @@ public class BukkitSchematicHandler extends SchematicHandler {
|
||||
@Override
|
||||
public void run() {
|
||||
long start = System.currentTimeMillis();
|
||||
while (!chunks.isEmpty() && ((System.currentTimeMillis() - start) < 20)) {
|
||||
while (!chunks.isEmpty() && System.currentTimeMillis() - start < 20) {
|
||||
// save schematics
|
||||
ChunkLoc chunk = chunks.remove(0);
|
||||
Chunk bc = worldObj.getChunkAt(chunk.x, chunk.z);
|
||||
@ -145,7 +144,7 @@ public class BukkitSchematicHandler extends SchematicHandler {
|
||||
int i1 = ry * width * length;
|
||||
for (int z = zzb; z <= zzt; z++) {
|
||||
int rz = z - bz;
|
||||
int i2 = i1 + (rz * width);
|
||||
int i2 = i1 + rz * width;
|
||||
for (int x = xxb; x <= xxt; x++) {
|
||||
int rx = x - bx;
|
||||
int index = i2 + rx;
|
||||
@ -219,9 +218,8 @@ public class BukkitSchematicHandler extends SchematicHandler {
|
||||
case 189:
|
||||
case 190:
|
||||
case 191:
|
||||
case 192: {
|
||||
case 192:
|
||||
break;
|
||||
}
|
||||
case 54:
|
||||
case 130:
|
||||
case 142:
|
||||
@ -256,17 +254,14 @@ public class BukkitSchematicHandler extends SchematicHandler {
|
||||
case 29:
|
||||
case 33:
|
||||
case 151:
|
||||
case 178: {
|
||||
case 178:
|
||||
// TODO implement fully
|
||||
BlockState state = block.getState();
|
||||
if (state != null) {
|
||||
StateWrapper wrapper = new StateWrapper(state);
|
||||
CompoundTag rawTag = wrapper.getTag();
|
||||
if (rawTag != null) {
|
||||
Map<String, Tag> values = new HashMap<>();
|
||||
for (Entry<String, Tag> entry : rawTag.getValue().entrySet()) {
|
||||
values.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
Map<String, Tag> values = new HashMap<>(rawTag.getValue());
|
||||
values.put("id", new StringTag("id", wrapper.getId()));
|
||||
values.put("x", new IntTag("x", x));
|
||||
values.put("y", new IntTag("y", y));
|
||||
@ -275,10 +270,8 @@ public class BukkitSchematicHandler extends SchematicHandler {
|
||||
tileEntities.add(tileEntityTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
default: {
|
||||
default:
|
||||
blockData[index] = block.getData();
|
||||
}
|
||||
}
|
||||
// For optimization reasons, we are not supporting custom data types
|
||||
// Especially since the most likely reason beyond this range is modded servers in which the blocks
|
||||
@ -310,7 +303,7 @@ public class BukkitSchematicHandler extends SchematicHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreTag(CompoundTag ct, short x, short y, short z, Schematic schem) {
|
||||
new StateWrapper(ct).restoreTag(x, y, z, schem);
|
||||
public void restoreTag(CompoundTag ct, short x, short y, short z, Schematic schematic) {
|
||||
new StateWrapper(ct).restoreTag(x, y, z, schematic);
|
||||
}
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
switch (type) {
|
||||
case 2: {
|
||||
if (object.id != null) {
|
||||
String areaname = object.id + "-" + object.min + "-" + object.max;
|
||||
String areaPath = "areas." + areaname;
|
||||
String areaName = object.id + "-" + object.min + "-" + object.max;
|
||||
String areaPath = "areas." + areaName;
|
||||
if (!worldSection.contains(areaPath)) {
|
||||
worldSection.createSection(areaPath);
|
||||
}
|
||||
@ -75,7 +75,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
options.put("generator.type", object.type);
|
||||
options.put("generator.terrain", object.terrain);
|
||||
options.put("generator.plugin", object.plotManager);
|
||||
if ((object.setupGenerator != null) && !object.setupGenerator.equals(object.plotManager)) {
|
||||
if (object.setupGenerator != null && !object.setupGenerator.equals(object.plotManager)) {
|
||||
options.put("generator.init", object.setupGenerator);
|
||||
}
|
||||
for (Entry<String, Object> entry : options.entrySet()) {
|
||||
@ -91,34 +91,32 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
GeneratorWrapper<?> gen = generators.get(object.setupGenerator);
|
||||
if ((gen != null) && gen.isFull()) {
|
||||
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
||||
if (gen != null && gen.isFull()) {
|
||||
object.setupGenerator = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
case 1:
|
||||
for (ConfigurationNode step : steps) {
|
||||
worldSection.set(step.getConstant(), step.getValue());
|
||||
}
|
||||
PS.get().config.set("worlds." + world + "." + "generator.type", object.type);
|
||||
PS.get().config.set("worlds." + world + "." + "generator.terrain", object.terrain);
|
||||
PS.get().config.set("worlds." + world + "." + "generator.plugin", object.plotManager);
|
||||
if ((object.setupGenerator != null) && !object.setupGenerator.equals(object.plotManager)) {
|
||||
if (object.setupGenerator != null && !object.setupGenerator.equals(object.plotManager)) {
|
||||
PS.get().config.set("worlds." + world + "." + "generator.init", object.setupGenerator);
|
||||
}
|
||||
GeneratorWrapper<?> gen = generators.get(object.setupGenerator);
|
||||
if ((gen != null) && gen.isFull()) {
|
||||
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
||||
if (gen != null && gen.isFull()) {
|
||||
object.setupGenerator = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
case 0:
|
||||
for (ConfigurationNode step : steps) {
|
||||
worldSection.set(step.getConstant(), step.getValue());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
try {
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
@ -126,7 +124,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (object.setupGenerator != null) {
|
||||
if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) && Bukkit.getPluginManager().getPlugin("Multiverse-Core")
|
||||
if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null && Bukkit.getPluginManager().getPlugin("Multiverse-Core")
|
||||
.isEnabled()) {
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv create " + world + " normal -g " + object.setupGenerator);
|
||||
@ -135,7 +133,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
|
||||
if (Bukkit.getPluginManager().getPlugin("MultiWorld") != null && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + world + " plugin:" + object.setupGenerator);
|
||||
setGenerator(world, object.setupGenerator);
|
||||
if (Bukkit.getWorld(world) != null) {
|
||||
@ -148,14 +146,14 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
Bukkit.createWorld(wc);
|
||||
setGenerator(world, object.setupGenerator);
|
||||
} else {
|
||||
if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) && Bukkit.getPluginManager().getPlugin("Multiverse-Core")
|
||||
if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null && Bukkit.getPluginManager().getPlugin("Multiverse-Core")
|
||||
.isEnabled()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv create " + world + " normal");
|
||||
if (Bukkit.getWorld(world) != null) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
|
||||
if (Bukkit.getPluginManager().getPlugin("MultiWorld") != null && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + world);
|
||||
if (Bukkit.getWorld(world) != null) {
|
||||
return world;
|
||||
@ -193,7 +191,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
if (!(generator instanceof BukkitPlotGenerator)) {
|
||||
return null;
|
||||
}
|
||||
for (Entry<String, GeneratorWrapper<?>> entry : generators.entrySet()) {
|
||||
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
|
||||
GeneratorWrapper<?> current = entry.getValue();
|
||||
if (current.equals(generator)) {
|
||||
return entry.getKey();
|
||||
|
@ -97,8 +97,8 @@ public class BukkitUtil extends WorldUtil {
|
||||
return entity.getWorld().getName();
|
||||
}
|
||||
|
||||
public static List<Entity> getEntities(String worldname) {
|
||||
return getWorld(worldname).getEntities();
|
||||
public static List<Entity> getEntities(String worldName) {
|
||||
return getWorld(worldName).getEntities();
|
||||
}
|
||||
|
||||
public static Location getLocation(Entity entity) {
|
||||
@ -114,8 +114,8 @@ public class BukkitUtil extends WorldUtil {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWorld(String world) {
|
||||
return getWorld(world) != null;
|
||||
public boolean isWorld(String worldName) {
|
||||
return getWorld(worldName) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,8 +124,8 @@ public class BukkitUtil extends WorldUtil {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSign(String worldname, int x, int y, int z, String[] lines) {
|
||||
World world = getWorld(worldname);
|
||||
public void setSign(String worldName, int x, int y, int z, String[] lines) {
|
||||
World world = getWorld(worldName);
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
// block.setType(Material.AIR);
|
||||
block.setTypeIdAndData(Material.WALL_SIGN.getId(), (byte) 2, false);
|
||||
@ -172,8 +172,8 @@ public class BukkitUtil extends WorldUtil {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveWorld(String worldname) {
|
||||
World world = getWorld(worldname);
|
||||
public void saveWorld(String worldName) {
|
||||
World world = getWorld(worldName);
|
||||
if (world != null) {
|
||||
world.save();
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ public class Metrics {
|
||||
// Construct the post data
|
||||
StringBuilder json = new StringBuilder(1024);
|
||||
json.append('{');
|
||||
// The plugin's description file containg all of the plugin data such as name, version, author, etc
|
||||
// The plugin's description file containing all of the plugin data such as name, version, author, etc
|
||||
appendJSONPair(json, "guid", this.guid);
|
||||
appendJSONPair(json, "plugin_version", pluginVersion);
|
||||
appendJSONPair(json, "server_version", serverVersion);
|
||||
|
@ -223,7 +223,7 @@ public class NbtFactory {
|
||||
|
||||
/**
|
||||
* Construct a new NBT wrapper from a compound.
|
||||
* @param nmsCompound - the NBT compund.
|
||||
* @param nmsCompound - the NBT compound.
|
||||
* @return The wrapper.
|
||||
*/
|
||||
public static NbtCompound fromCompound(Object nmsCompound) {
|
||||
@ -247,7 +247,7 @@ public class NbtFactory {
|
||||
|
||||
/**
|
||||
* Construct a wrapper for an NBT tag stored (in memory) in an item stack. This is where
|
||||
* auxillary data such as enchanting, name and lore is stored. It does not include items
|
||||
* auxiliary data such as enchanting, name and lore is stored. It does not include items
|
||||
* material, damage value or count.
|
||||
* <p>
|
||||
* The item stack must be a wrapper for a CraftItemStack.
|
||||
@ -669,7 +669,7 @@ public class NbtFactory {
|
||||
super(handle, getDataMap(handle));
|
||||
}
|
||||
|
||||
// Simplifiying access to each value
|
||||
// Simplifying access to each value
|
||||
public Byte getByte(String key, Byte defaultValue) {
|
||||
return containsKey(key) ? (Byte) get(key) : defaultValue;
|
||||
}
|
||||
|
@ -116,10 +116,10 @@ public class SendChunk {
|
||||
try {
|
||||
chunk.unload(true, false);
|
||||
} catch (Throwable e) {
|
||||
String worldname = chunk.getWorld().getName();
|
||||
PS.debug("$4Could not save chunk: " + worldname + ";" + chunk.getX() + ";" + chunk.getZ());
|
||||
String worldName = chunk.getWorld().getName();
|
||||
PS.debug("$4Could not save chunk: " + worldName + ";" + chunk.getX() + ";" + chunk.getZ());
|
||||
PS.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
|
||||
PS.debug("$3 - $4" + worldname + "/level.dat or " + worldname
|
||||
PS.debug("$3 - $4" + worldName + "/level.dat or " + worldName
|
||||
+ "/level_old.dat may be corrupt (try repairing or removing these)");
|
||||
}
|
||||
}
|
||||
@ -127,12 +127,12 @@ public class SendChunk {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendChunk(String worldname, Collection<ChunkLoc> chunkLocs) {
|
||||
World myworld = Bukkit.getWorld(worldname);
|
||||
public void sendChunk(String worldName, Collection<ChunkLoc> chunkLocations) {
|
||||
World myWorld = Bukkit.getWorld(worldName);
|
||||
ArrayList<Chunk> chunks = new ArrayList<>();
|
||||
for (ChunkLoc loc : chunkLocs) {
|
||||
if (myworld.isChunkLoaded(loc.x, loc.z)) {
|
||||
chunks.add(myworld.getChunkAt(loc.x, loc.z));
|
||||
for (ChunkLoc loc : chunkLocations) {
|
||||
if (myWorld.isChunkLoaded(loc.x, loc.z)) {
|
||||
chunks.add(myWorld.getChunkAt(loc.x, loc.z));
|
||||
}
|
||||
}
|
||||
sendChunk(chunks);
|
||||
|
@ -45,10 +45,10 @@ public class SetGenCB {
|
||||
}
|
||||
}
|
||||
if (!set) {
|
||||
Iterator<BlockPopulator> iter = world.getPopulators().iterator();
|
||||
while (iter.hasNext()) {
|
||||
if (iter.next() instanceof BukkitAugmentedGenerator) {
|
||||
iter.remove();
|
||||
Iterator<BlockPopulator> iterator = world.getPopulators().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
if (iterator.next() instanceof BukkitAugmentedGenerator) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +34,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
||||
private final RefMethod methodA;
|
||||
private final RefMethod methodGetById;
|
||||
private final RefMethod methodInitLighting;
|
||||
|
||||
private final SendChunk chunksender;
|
||||
private final SendChunk sendChunk;
|
||||
|
||||
private final HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
|
||||
|
||||
@ -45,7 +44,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
||||
this.methodA = this.classChunk.getMethod("a", int.class, int.class, int.class, this.classBlock, int.class);
|
||||
this.methodGetById = this.classBlock.getMethod("getById", int.class);
|
||||
this.methodInitLighting = this.classChunk.getMethod("initLighting");
|
||||
this.chunksender = new SendChunk();
|
||||
this.sendChunk = new SendChunk();
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -82,7 +81,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.chunksender.sendChunk(chunks);
|
||||
this.sendChunk.sendChunk(chunks);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
MainUtil.canSendChunk = false;
|
||||
@ -175,6 +174,6 @@ public class FastQueue_1_7 extends SlowQueue {
|
||||
ChunkWrapper wrapper = SetQueue.IMP.new ChunkWrapper(world, loc.x, loc.z);
|
||||
this.toUpdate.remove(wrapper);
|
||||
}
|
||||
this.chunksender.sendChunk(world, locations);
|
||||
this.sendChunk.sendChunk(world, locations);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
private final RefMethod methodA;
|
||||
private final RefMethod methodGetByCombinedId;
|
||||
private final RefConstructor constructorBlockPosition;
|
||||
private final SendChunk chunksender;
|
||||
private final SendChunk sendChunk;
|
||||
|
||||
public FastQueue_1_8() throws RuntimeException {
|
||||
this.methodInitLighting = this.classChunk.getMethod("initLighting");
|
||||
@ -49,7 +49,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
this.methodGetHandle = this.classCraftWorld.getMethod("getHandle");
|
||||
this.methodGetChunkAt = this.classWorld.getMethod("getChunkAt", int.class, int.class);
|
||||
this.methodA = this.classChunk.getMethod("a", this.classBlockPosition, this.classIBlockData);
|
||||
this.chunksender = new SendChunk();
|
||||
this.sendChunk = new SendChunk();
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -59,7 +59,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
int count = 0;
|
||||
ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||
Iterator<Entry<ChunkWrapper, Chunk>> i = FastQueue_1_8.this.toUpdate.entrySet().iterator();
|
||||
while (i.hasNext() && (count < 128)) {
|
||||
while (i.hasNext() && count < 128) {
|
||||
chunks.add(i.next().getValue());
|
||||
i.remove();
|
||||
count++;
|
||||
@ -86,7 +86,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.chunksender.sendChunk(chunks);
|
||||
this.sendChunk.sendChunk(chunks);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
MainUtil.canSendChunk = false;
|
||||
@ -161,7 +161,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
case 29:
|
||||
case 33:
|
||||
case 151:
|
||||
case 178: {
|
||||
case 178:
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
if (block.getData() == newBlock.data) {
|
||||
if (block.getTypeId() != newBlock.id) {
|
||||
@ -175,7 +175,6 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Start data value shortcut
|
||||
@ -263,9 +262,8 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
case 189:
|
||||
case 190:
|
||||
case 191:
|
||||
case 192: {
|
||||
case 192:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (block.getData() == newBlock.data) {
|
||||
return;
|
||||
@ -311,14 +309,13 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
case 29:
|
||||
case 33:
|
||||
case 151:
|
||||
case 178: {
|
||||
case 178:
|
||||
if (block.getData() == newBlock.data) {
|
||||
block.setTypeId(newBlock.id, false);
|
||||
} else {
|
||||
block.setTypeIdAndData(newBlock.id, newBlock.data, false);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// End blockstate workaround //
|
||||
|
||||
@ -378,6 +375,6 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
ChunkWrapper wrapper = SetQueue.IMP.new ChunkWrapper(world, loc.x, loc.z);
|
||||
this.toUpdate.remove(wrapper);
|
||||
}
|
||||
this.chunksender.sendChunk(world, locations);
|
||||
this.sendChunk.sendChunk(world, locations);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.plotsquared.bukkit.util.block;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
@ -14,6 +16,12 @@ import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.util.SendChunk;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@ -23,18 +31,10 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
public class FastQueue_1_8_3 extends SlowQueue {
|
||||
|
||||
private final SendChunk chunksender;
|
||||
private final SendChunk sendChunk;
|
||||
private final HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
|
||||
private final RefMethod methodGetHandleChunk;
|
||||
private final RefMethod methodInitLighting;
|
||||
@ -65,7 +65,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
this.classChunkSectionConstructor = classChunkSection.getConstructor(int.class, boolean.class, char[].class);
|
||||
this.tileEntityUnload = classWorld.getField("c");
|
||||
this.methodGetWorld = classChunk.getMethod("getWorld");
|
||||
this.chunksender = new SendChunk();
|
||||
this.sendChunk = new SendChunk();
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -102,7 +102,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.chunksender.sendChunk(chunks);
|
||||
this.sendChunk.sendChunk(chunks);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
MainUtil.canSendChunk = false;
|
||||
@ -129,7 +129,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
// Sections
|
||||
Method getHandle = chunk.getClass().getDeclaredMethod("getHandle");
|
||||
Object c = getHandle.invoke(chunk);
|
||||
Object w = methodGetWorld.of(c).call();
|
||||
Object w = this.methodGetWorld.of(c).call();
|
||||
Class<? extends Object> clazz = c.getClass();
|
||||
Field sections1 = clazz.getDeclaredField("sections");
|
||||
sections1.setAccessible(true);
|
||||
@ -138,7 +138,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
|
||||
Object[] sections = (Object[]) sections1.get(c);
|
||||
HashMap<?, ?> tiles = (HashMap<?, ?>) tileEntities.get(c);
|
||||
Collection<Object> tilesUnload = (Collection<Object>) tileEntityUnload.of(w).get();
|
||||
Collection<Object> tilesUnload = (Collection<Object>) this.tileEntityUnload.of(w).get();
|
||||
Collection<?>[] entities = (Collection<?>[]) entitySlices.get(c);
|
||||
|
||||
Method getX = null;
|
||||
@ -407,6 +407,6 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
ChunkWrapper wrapper = SetQueue.IMP.new ChunkWrapper(world, loc.x, loc.z);
|
||||
this.toUpdate.remove(wrapper);
|
||||
}
|
||||
this.chunksender.sendChunk(world, locations);
|
||||
this.sendChunk.sendChunk(world, locations);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.plotsquared.bukkit.util.block;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
@ -15,6 +17,12 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.SendChunk;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@ -24,14 +32,6 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
public class FastQueue_1_9 extends SlowQueue {
|
||||
|
||||
@ -143,7 +143,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
// Sections
|
||||
Method getHandle = chunk.getClass().getDeclaredMethod("getHandle");
|
||||
Object c = getHandle.invoke(chunk);
|
||||
Object w = methodGetWorld.of(c).call();
|
||||
Object w = this.methodGetWorld.of(c).call();
|
||||
Class<? extends Object> clazz = c.getClass();
|
||||
Field sf = clazz.getDeclaredField("sections");
|
||||
sf.setAccessible(true);
|
||||
@ -152,7 +152,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
|
||||
Object[] sections = (Object[]) sf.get(c);
|
||||
HashMap<?, ?> tiles = (HashMap<?, ?>) tf.get(c);
|
||||
Collection<Object> tilesUnload = (Collection<Object>) tileEntityUnload.of(w).get();
|
||||
Collection<Object> tilesUnload = (Collection<Object>) this.tileEntityUnload.of(w).get();
|
||||
Collection<?>[] entities = (Collection<?>[]) entitySlices.get(c);
|
||||
|
||||
Method xm = null;
|
||||
@ -230,13 +230,12 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
setType.call(x, y & 15, z, this.air);
|
||||
continue;
|
||||
}
|
||||
default: {
|
||||
default:
|
||||
int x = MainUtil.x_loc[j][k];
|
||||
int y = MainUtil.y_loc[j][k];
|
||||
int z = MainUtil.z_loc[j][k];
|
||||
Object iBlock = this.methodGetByCombinedId.call((int) n);
|
||||
setType.call(x, y & 15, z, iBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fill) {
|
||||
@ -306,7 +305,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
if (fixAll && !(boolean) this.methodAreNeighborsLoaded.of(c).call(1)) {
|
||||
World world = chunk.getWorld();
|
||||
ChunkWrapper wrapper = bc.getChunkWrapper();
|
||||
String worldname = wrapper.world;
|
||||
String worldName = wrapper.world;
|
||||
for (int x = wrapper.x - 1; x <= wrapper.x + 1; x++) {
|
||||
for (int z = wrapper.z - 1; z <= wrapper.z + 1; z++) {
|
||||
if (x != 0 && z != 0) {
|
||||
@ -314,7 +313,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
while (!other.isLoaded()) {
|
||||
other.load(true);
|
||||
}
|
||||
ChunkManager.manager.loadChunk(worldname, new ChunkLoc(x, z), true);
|
||||
ChunkManager.manager.loadChunk(worldName, new ChunkLoc(x, z), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,12 +62,12 @@ public class SlowQueue implements PlotQueue<Chunk> {
|
||||
if (this.blocks.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Iterator<Entry<ChunkWrapper, PlotChunk<Chunk>>> iter = this.blocks.entrySet().iterator();
|
||||
PlotChunk<Chunk> toReturn = iter.next().getValue();
|
||||
Iterator<Entry<ChunkWrapper, PlotChunk<Chunk>>> iterator = this.blocks.entrySet().iterator();
|
||||
PlotChunk<Chunk> toReturn = iterator.next().getValue();
|
||||
if (SetQueue.IMP.isWaiting()) {
|
||||
return null;
|
||||
}
|
||||
iter.remove();
|
||||
iterator.remove();
|
||||
execute(toReturn);
|
||||
fixLighting(toReturn, true);
|
||||
return toReturn;
|
||||
|
@ -55,10 +55,10 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
@Override
|
||||
public void run() {
|
||||
PS.debug(C.PREFIX + "&6Starting player data caching for: " + world);
|
||||
File uuidfile = new File(PS.get().IMP.getDirectory(), "uuids.txt");
|
||||
if (uuidfile.exists()) {
|
||||
File uuidFile = new File(PS.get().IMP.getDirectory(), "uuids.txt");
|
||||
if (uuidFile.exists()) {
|
||||
try {
|
||||
List<String> lines = Files.readAllLines(uuidfile.toPath(), StandardCharsets.UTF_8);
|
||||
List<String> lines = Files.readAllLines(uuidFile.toPath(), StandardCharsets.UTF_8);
|
||||
for (String line : lines) {
|
||||
try {
|
||||
line = line.trim();
|
||||
@ -89,8 +89,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
toAdd.put(new StringWrapper("*"), DBFunc.everyone);
|
||||
HashSet<UUID> all = UUIDHandler.getAllUUIDS();
|
||||
PS.debug("&aFast mode UUID caching enabled!");
|
||||
File playerdataFolder = new File(container, world + File.separator + "playerdata");
|
||||
String[] dat = playerdataFolder.list(new FilenameFilter() {
|
||||
File playerDataFolder = new File(container, world + File.separator + "playerdata");
|
||||
String[] dat = playerDataFolder.list(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File f, String s) {
|
||||
return s.endsWith(".dat");
|
||||
@ -103,7 +103,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
try {
|
||||
UUID uuid = UUID.fromString(s);
|
||||
if (check || all.remove(uuid)) {
|
||||
File file = new File(playerdataFolder + File.separator + current);
|
||||
File file = new File(playerDataFolder + File.separator + current);
|
||||
InputSupplier<FileInputStream> is = com.google.common.io.Files.newInputStreamSupplier(file);
|
||||
NbtFactory.NbtCompound compound = NbtFactory.fromStream(is, NbtFactory.StreamOptions.GZIP_COMPRESSION);
|
||||
NbtFactory.NbtCompound bukkit = (NbtFactory.NbtCompound) compound.get("bukkit");
|
||||
@ -137,11 +137,11 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
worlds.add("world");
|
||||
HashSet<UUID> uuids = new HashSet<>();
|
||||
HashSet<String> names = new HashSet<>();
|
||||
File playerdataFolder = null;
|
||||
File playerDataFolder = null;
|
||||
for (String worldName : worlds) {
|
||||
// Getting UUIDs
|
||||
playerdataFolder = new File(container, worldName + File.separator + "playerdata");
|
||||
String[] dat = playerdataFolder.list(new FilenameFilter() {
|
||||
playerDataFolder = new File(container, worldName + File.separator + "playerdata");
|
||||
String[] dat = playerDataFolder.list(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File f, String s) {
|
||||
return s.endsWith(".dat");
|
||||
@ -154,7 +154,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
UUID uuid = UUID.fromString(s);
|
||||
uuids.add(uuid);
|
||||
} catch (Exception e) {
|
||||
PS.debug(C.PREFIX + "Invalid playerdata: " + current);
|
||||
PS.debug(C.PREFIX + "Invalid PlayerData: " + current);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -176,7 +176,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
for (UUID uuid : uuids) {
|
||||
try {
|
||||
File file = new File(playerdataFolder + File.separator + uuid.toString() + ".dat");
|
||||
File file = new File(playerDataFolder + File.separator + uuid.toString() + ".dat");
|
||||
if (!file.exists()) {
|
||||
continue;
|
||||
}
|
||||
@ -199,7 +199,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
toAdd.put(new StringWrapper(name), uuid);
|
||||
} catch (Throwable e) {
|
||||
PS.debug(C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
||||
PS.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
||||
}
|
||||
}
|
||||
for (String name : names) {
|
||||
|
@ -151,7 +151,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
|
||||
@Override
|
||||
public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
|
||||
PS.debug(C.PREFIX + "UUID for '" + name + "' was null. We'll cache this from the mojang servers!");
|
||||
PS.debug(C.PREFIX + "UUID for '" + name + "' was null. We'll cache this from the Mojang servers!");
|
||||
if (ifFetch == null) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user