mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Bug Fix and Cleanup
This commit is contained in:
@ -54,8 +54,7 @@ public class PlotAPI {
|
||||
* @deprecated Not needed
|
||||
*/
|
||||
@Deprecated
|
||||
public PlotAPI(JavaPlugin plugin) {
|
||||
}
|
||||
public PlotAPI(JavaPlugin plugin) {}
|
||||
|
||||
/**
|
||||
* Get all plots.
|
||||
|
@ -141,9 +141,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
this.getServer().getConsoleSender().sendMessage(message);
|
||||
return;
|
||||
} catch (Throwable ignored) {
|
||||
//ignored
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
System.out.println(ConsoleColors.fromString(message));
|
||||
}
|
||||
|
||||
@ -401,14 +399,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
try {
|
||||
new SendChunk();
|
||||
MainUtil.canSendChunk = true;
|
||||
} catch (Throwable e) {
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
MainUtil.canSendChunk = false;
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), 1, 9, 0)) {
|
||||
try {
|
||||
return new FastQueue_1_9();
|
||||
} catch (Throwable e) {
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
return new SlowQueue();
|
||||
}
|
||||
@ -416,11 +414,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
if (PS.get().checkVersion(getServerVersion(), 1, 8, 0)) {
|
||||
try {
|
||||
return new FastQueue_1_8_3();
|
||||
} catch (Throwable e) {
|
||||
} catch (NoSuchMethodException | ClassNotFoundException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
return new FastQueue_1_8();
|
||||
} catch (Throwable e2) {
|
||||
} catch (NoSuchMethodException | NoSuchFieldException | ClassNotFoundException e2) {
|
||||
e2.printStackTrace();
|
||||
return new SlowQueue();
|
||||
}
|
||||
@ -428,7 +426,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
try {
|
||||
return new FastQueue_1_7();
|
||||
} catch (Throwable e) {
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
return new SlowQueue();
|
||||
}
|
||||
@ -657,7 +655,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
public List<String> getPluginIds() {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
names.add(plugin.getName() + ";" + plugin.getDescription().getVersion() + ":" + plugin.isEnabled());
|
||||
names.add(plugin.getName() + ';' + plugin.getDescription().getVersion() + ':' + plugin.isEnabled());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ public class DebugUUID extends SubCommand {
|
||||
}
|
||||
try {
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
MainUtil.sendMessage(player, "Could not save configuration. It will need to be manual set!");
|
||||
}
|
||||
|
||||
|
@ -42,9 +42,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
} else {
|
||||
return new SQLite(dataFolder + File.separator + "plots.db").openConnection();
|
||||
}
|
||||
} catch (SQLException | ClassNotFoundException ignored) {
|
||||
//ignored
|
||||
ignored.printStackTrace();
|
||||
} catch (SQLException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -229,9 +228,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
resultSet.close();
|
||||
statement.close();
|
||||
|
||||
} catch (SQLException ignored) {
|
||||
//ignored
|
||||
}
|
||||
} catch (SQLException ignored) {}
|
||||
return plots;
|
||||
}
|
||||
|
||||
|
@ -200,9 +200,7 @@ public class LikePlotMeConverter {
|
||||
PS.get().config.set("worlds." + actualWorldName + ".wall.height", height);
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
//ignored
|
||||
}
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
||||
String world = entry.getKey();
|
||||
|
@ -233,7 +233,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ArrayList<BlockPopulator> toAdd = new ArrayList<BlockPopulator>();
|
||||
ArrayList<BlockPopulator> toAdd = new ArrayList<>();
|
||||
List<BlockPopulator> existing = world.getPopulators();
|
||||
for (BlockPopulator populator : this.populators) {
|
||||
if (!existing.contains(populator)) {
|
||||
|
@ -31,22 +31,21 @@ import java.util.Set;
|
||||
|
||||
public class WEListener implements Listener {
|
||||
|
||||
public final HashSet<String> rad1 = new HashSet<>(
|
||||
public final Set<String> other = new HashSet<>(Arrays.asList("undo", "redo"));
|
||||
private final Set<String> rad1 = new HashSet<>(
|
||||
Arrays.asList("forestgen", "pumpkins", "drain", "fixwater", "fixlava", "replacenear", "snow", "thaw", "ex", "butcher", "size"));
|
||||
public final HashSet<String> rad2 = new HashSet<>(Arrays.asList("fill", "fillr", "removenear", "remove"));
|
||||
public final HashSet<String> rad2_1 = new HashSet<>(Arrays.asList("hcyl", "cyl"));
|
||||
public final HashSet<String> rad2_2 = new HashSet<>(Arrays.asList("sphere", "pyramid"));
|
||||
public final Set<String> rad2_3 = Collections.singleton("brush smooth");
|
||||
public final Set<String> rad3_1 = Collections.singleton("brush gravity");
|
||||
public final HashSet<String> rad3_2 = new HashSet<>(Arrays.asList("brush sphere", "brush cylinder"));
|
||||
|
||||
public final HashSet<String> region = new HashSet<>(
|
||||
private final Set<String> rad2 = new HashSet<>(Arrays.asList("fill", "fillr", "removenear", "remove"));
|
||||
private final Set<String> rad2_1 = new HashSet<>(Arrays.asList("hcyl", "cyl"));
|
||||
private final Set<String> rad2_2 = new HashSet<>(Arrays.asList("sphere", "pyramid"));
|
||||
private final Set<String> rad2_3 = Collections.singleton("brush smooth");
|
||||
private final Set<String> rad3_1 = Collections.singleton("brush gravity");
|
||||
private final Set<String> rad3_2 = new HashSet<>(Arrays.asList("brush sphere", "brush cylinder"));
|
||||
private final Set<String> region = new HashSet<>(
|
||||
Arrays.asList("move", "set", "replace", "overlay", "walls", "outline", "deform", "hollow", "smooth", "naturalize", "paste", "count",
|
||||
"distr",
|
||||
"regen", "copy", "cut", "green", "setbiome"));
|
||||
public final Set<String> regionExtend = Collections.singleton("stack");
|
||||
public final Set<String> restricted = Collections.singleton("up");
|
||||
public final HashSet<String> other = new HashSet<>(Arrays.asList("undo", "redo"));
|
||||
private final Set<String> regionExtend = Collections.singleton("stack");
|
||||
private final Set<String> restricted = Collections.singleton("up");
|
||||
|
||||
public String reduceCmd(String cmd, boolean single) {
|
||||
if (cmd.startsWith("/worldedit:/")) {
|
||||
@ -75,14 +74,14 @@ public class WEListener implements Listener {
|
||||
}
|
||||
}
|
||||
return max;
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkVolume(PlotPlayer player, long volume, long max, Cancellable e) {
|
||||
if (volume > max) {
|
||||
MainUtil.sendMessage(player, C.WORLDEDIT_VOLUME.s().replaceAll("%current%", volume + "").replaceAll("%max%", max + ""));
|
||||
MainUtil.sendMessage(player, C.WORLDEDIT_VOLUME.s().replaceAll("%current%", String.valueOf(volume)).replaceAll("%max%", String.valueOf(max)));
|
||||
e.setCancelled(true);
|
||||
}
|
||||
if (Permissions.hasPermission(player, "plots.worldedit.bypass")) {
|
||||
@ -181,7 +180,7 @@ public class WEListener implements Listener {
|
||||
boolean single = true;
|
||||
if (split.length >= 2) {
|
||||
String reduced = reduceCmd(split[0], single);
|
||||
String reduced2 = reduceCmd(split[0] + " " + split[1], single);
|
||||
String reduced2 = reduceCmd(split[0] + ' ' + split[1], single);
|
||||
if (this.rad1.contains(reduced)) {
|
||||
if (delay(p, message, false)) {
|
||||
e.setCancelled(true);
|
||||
@ -234,7 +233,8 @@ public class WEListener implements Listener {
|
||||
int iterations = getInt(split[3]);
|
||||
if (iterations > maxIterations) {
|
||||
MainUtil.sendMessage(pp,
|
||||
C.WORLDEDIT_ITERATIONS.s().replaceAll("%current%", iterations + "").replaceAll("%max%", maxIterations + ""));
|
||||
C.WORLDEDIT_ITERATIONS.s().replaceAll("%current%", String.valueOf(iterations)).replaceAll("%max%",
|
||||
String.valueOf(maxIterations)));
|
||||
e.setCancelled(true);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
||||
|
@ -465,8 +465,7 @@ public class EntityWrapper {
|
||||
if (this.base.passenger != null) {
|
||||
try {
|
||||
entity.setPassenger(this.base.passenger.spawn(world, x_offset, z_offset));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
if (this.base.fall != 0) {
|
||||
entity.setFallDistance(this.base.fall);
|
||||
|
@ -143,8 +143,7 @@ public class HackTitleManager extends TitleManager {
|
||||
private Class<?> getClass(String namespace) {
|
||||
try {
|
||||
return Class.forName(namespace);
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
@ -616,25 +617,25 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
|
||||
public static class ContentMap {
|
||||
|
||||
public final HashMap<BlockLoc, ItemStack[]> chestContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> furnaceContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> dispenserContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> dropperContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> brewingStandContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> beaconContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> hopperContents;
|
||||
public final HashMap<BlockLoc, Short[]> furnaceTime;
|
||||
public final HashMap<BlockLoc, Object[]> skullData;
|
||||
public final HashMap<BlockLoc, Material> jukeboxDisc;
|
||||
public final HashMap<BlockLoc, Short> brewTime;
|
||||
public final HashMap<BlockLoc, EntityType> spawnerData;
|
||||
public final HashMap<BlockLoc, String> cmdData;
|
||||
public final HashMap<BlockLoc, String[]> signContents;
|
||||
public final HashMap<BlockLoc, Note> noteBlockContents;
|
||||
public final HashMap<BlockLoc, List<Pattern>> bannerPatterns;
|
||||
public final HashMap<BlockLoc, DyeColor> bannerBase;
|
||||
public final HashSet<EntityWrapper> entities;
|
||||
public final HashMap<PlotLoc, PlotBlock[]> allBlocks;
|
||||
public final Map<BlockLoc, ItemStack[]> chestContents;
|
||||
public final Map<BlockLoc, ItemStack[]> furnaceContents;
|
||||
public final Map<BlockLoc, ItemStack[]> dispenserContents;
|
||||
public final Map<BlockLoc, ItemStack[]> dropperContents;
|
||||
public final Map<BlockLoc, ItemStack[]> brewingStandContents;
|
||||
public final Map<BlockLoc, ItemStack[]> beaconContents;
|
||||
public final Map<BlockLoc, ItemStack[]> hopperContents;
|
||||
public final Map<BlockLoc, Short[]> furnaceTime;
|
||||
public final Map<BlockLoc, Object[]> skullData;
|
||||
public final Map<BlockLoc, Material> jukeboxDisc;
|
||||
public final Map<BlockLoc, Short> brewTime;
|
||||
public final Map<BlockLoc, EntityType> spawnerData;
|
||||
public final Map<BlockLoc, String> cmdData;
|
||||
public final Map<BlockLoc, String[]> signContents;
|
||||
public final Map<BlockLoc, Note> noteBlockContents;
|
||||
public final Map<BlockLoc, List<Pattern>> bannerPatterns;
|
||||
public final Map<BlockLoc, DyeColor> bannerBase;
|
||||
public final Set<EntityWrapper> entities;
|
||||
public final Map<PlotLoc, PlotBlock[]> allBlocks;
|
||||
|
||||
public ContentMap() {
|
||||
this.chestContents = new HashMap<>();
|
||||
|
@ -49,8 +49,7 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
}
|
||||
final BiomeGrid nullBiomeGrid = new BiomeGrid() {
|
||||
@Override
|
||||
public void setBiome(int a, int b, Biome c) {
|
||||
}
|
||||
public void setBiome(int a, int b, Biome c) {}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(int a, int b) {
|
||||
|
@ -22,12 +22,10 @@ public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tooltip(PlotMessage message, PlotMessage... tooltips) {
|
||||
}
|
||||
public void tooltip(PlotMessage message, PlotMessage... tooltips) {}
|
||||
|
||||
@Override
|
||||
public void command(PlotMessage message, String command) {
|
||||
}
|
||||
public void command(PlotMessage message, String command) {}
|
||||
|
||||
@Override
|
||||
public void text(PlotMessage message, String text) {
|
||||
@ -44,7 +42,6 @@ public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suggest(PlotMessage plotMessage, String command) {
|
||||
}
|
||||
public void suggest(PlotMessage plotMessage, String command) {}
|
||||
|
||||
}
|
||||
|
@ -271,8 +271,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
try {
|
||||
Material material = Material.valueOf(name.toUpperCase());
|
||||
return new StringComparison<PlotBlock>().new ComparisonResult(0, new PlotBlock((short) material.getId(), (byte) 0));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
try {
|
||||
byte data;
|
||||
String[] split = name.split(":");
|
||||
@ -296,8 +295,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
StringComparison<PlotBlock> outer = new StringComparison<>();
|
||||
return outer.new ComparisonResult(match, block);
|
||||
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
} catch (NumberFormatException ignored) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -95,8 +95,7 @@ public class Metrics {
|
||||
if (gzos != null) {
|
||||
try {
|
||||
gzos.close();
|
||||
} catch (IOException ignore) {
|
||||
}
|
||||
} catch (IOException ignore) {}
|
||||
}
|
||||
}
|
||||
return baos.toByteArray();
|
||||
@ -117,7 +116,7 @@ public class Metrics {
|
||||
Double.parseDouble(value);
|
||||
isValueNumeric = true;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
isValueNumeric = false;
|
||||
}
|
||||
if (json.charAt(json.length() - 1) != '{') {
|
||||
@ -446,7 +445,7 @@ public class Metrics {
|
||||
try {
|
||||
Class.forName("mineshafter.MineServer");
|
||||
return true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -569,8 +568,7 @@ public class Metrics {
|
||||
/**
|
||||
* Called after the website graphs have been updated
|
||||
*/
|
||||
public void reset() {
|
||||
}
|
||||
public void reset() {}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
@ -42,7 +42,7 @@ public class SendChunk {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public SendChunk() {
|
||||
public SendChunk() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException {
|
||||
RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer");
|
||||
this.methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
|
||||
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
|
@ -38,7 +38,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
||||
|
||||
private final HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
|
||||
|
||||
public FastQueue_1_7() throws RuntimeException {
|
||||
public FastQueue_1_7() throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException {
|
||||
this.methodGetHandle = this.classCraftWorld.getMethod("getHandle");
|
||||
this.methodGetChunkAt = this.classWorld.getMethod("getChunkAt", int.class, int.class);
|
||||
this.methodA = this.classChunk.getMethod("a", int.class, int.class, int.class, this.classBlock, int.class);
|
||||
|
@ -41,7 +41,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
private final RefConstructor constructorBlockPosition;
|
||||
private final SendChunk sendChunk;
|
||||
|
||||
public FastQueue_1_8() throws RuntimeException {
|
||||
public FastQueue_1_8() throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException {
|
||||
this.methodInitLighting = this.classChunk.getMethod("initLighting");
|
||||
this.constructorBlockPosition = this.classBlockPosition.getConstructor(int.class, int.class, int.class);
|
||||
this.methodGetByCombinedId = this.classBlock.getMethod("getByCombinedId", int.class);
|
||||
@ -56,7 +56,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
return;
|
||||
}
|
||||
int count = 0;
|
||||
ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||
ArrayList<Chunk> chunks = new ArrayList<>();
|
||||
Iterator<Entry<ChunkWrapper, Chunk>> i = FastQueue_1_8.this.toUpdate.entrySet().iterator();
|
||||
while (i.hasNext() && count < 128) {
|
||||
chunks.add(i.next().getValue());
|
||||
|
@ -49,7 +49,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
private final RefMethod methodGetWorld;
|
||||
private final RefField tileEntityListTick;
|
||||
|
||||
public FastQueue_1_8_3() throws RuntimeException {
|
||||
public FastQueue_1_8_3() throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException {
|
||||
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
|
@ -53,7 +53,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
private final RefField tileEntityListTick;
|
||||
|
||||
|
||||
public FastQueue_1_9() throws RuntimeException {
|
||||
public FastQueue_1_9() throws NoSuchFieldException, NoSuchMethodException, ClassNotFoundException {
|
||||
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
@ -48,11 +49,9 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
|
||||
@Override
|
||||
public OfflinePlotPlayer getOfflinePlayer(UUID uuid) {
|
||||
BiMap<UUID, StringWrapper> map = UUIDHandler.getUuidMap().inverse();
|
||||
String name;
|
||||
try {
|
||||
String name = null;
|
||||
if (map.containsKey(uuid)) {
|
||||
name = map.get(uuid).value;
|
||||
} catch (NullPointerException e) {
|
||||
name = null;
|
||||
}
|
||||
if (name != null) {
|
||||
OfflinePlayer op = Bukkit.getOfflinePlayer(name);
|
||||
@ -81,7 +80,7 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
|
||||
@SuppressWarnings("unchecked") Collection<? extends Player> p = (Collection<? extends Player>) players;
|
||||
return p.toArray(new Player[p.size()]);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ignored) {
|
||||
PS.debug("Failed to resolve online players");
|
||||
this.getOnline = null;
|
||||
Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();
|
||||
|
Reference in New Issue
Block a user