Misc. changes and removal of title manager

This commit is contained in:
MattBDev 2019-05-17 18:49:09 -04:00
parent 4e3a927323
commit 5dd2610b5e
26 changed files with 112 additions and 126 deletions

View File

@ -7,7 +7,6 @@ import com.github.intellectualsites.plotsquared.bukkit.listeners.PlayerEvents;
import com.github.intellectualsites.plotsquared.bukkit.listeners.PlotPlusListener;
import com.github.intellectualsites.plotsquared.bukkit.listeners.SingleWorldListener;
import com.github.intellectualsites.plotsquared.bukkit.listeners.WorldEvents;
import com.github.intellectualsites.plotsquared.bukkit.titles.DefaultTitle;
import com.github.intellectualsites.plotsquared.bukkit.util.*;
import com.github.intellectualsites.plotsquared.bukkit.util.block.BukkitLocalQueue;
import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
@ -766,10 +765,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
return new BukkitSchematicHandler();
}
@Override public AbstractTitle initTitleManager() {
return new DefaultTitle();
}
@Override @Nullable public PlotPlayer wrapPlayer(final Object player) {
if (player instanceof Player) {
return BukkitUtil.getPlayer((Player) player);

View File

@ -43,10 +43,6 @@ public final class Reflection {
*/
public synchronized static String getVersion() {
if (_versionString == null) {
if (Bukkit.getServer() == null) {
// The server hasn't started, static initializer call?
return null;
}
String name = Bukkit.getServer().getClass().getPackage().getName();
_versionString = name.substring(name.lastIndexOf('.') + 1) + ".";
}
@ -180,15 +176,11 @@ public final class Reflection {
* @return A method object with the specified name declared by the specified class.
*/
public synchronized static Method getMethod(Class<?> clazz, String name, Class<?>... args) {
if (!_loadedMethods.containsKey(clazz)) {
_loadedMethods.put(clazz, new HashMap<>());
}
_loadedMethods.computeIfAbsent(clazz, k -> new HashMap<>());
Map<String, Map<ArrayWrapper<Class<?>>, Method>> loadedMethodNames =
_loadedMethods.get(clazz);
if (!loadedMethodNames.containsKey(name)) {
loadedMethodNames.put(name, new HashMap<>());
}
loadedMethodNames.computeIfAbsent(name, k -> new HashMap<>());
Map<ArrayWrapper<Class<?>>, Method> loadedSignatures = loadedMethodNames.get(name);
ArrayWrapper<Class<?>> wrappedArg = new ArrayWrapper<>(args);

View File

@ -999,7 +999,7 @@ import java.util.regex.Pattern;
} else if (
(location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
&& !Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true);
MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.s()
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
@ -2984,7 +2984,7 @@ import java.util.regex.Pattern;
Plot plot = area.getPlot(location);
if (plot != null) {
if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
&& !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
&& !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true);
MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.s()
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));

View File

@ -84,6 +84,11 @@ public class BukkitPlayer extends PlotPlayer {
return true;
}
@Override
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
player.sendTitle(title, subtitle, fadeIn, stay, fadeOut);
}
private void callEvent(final Event event) {
RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
for (RegisteredListener listener : listeners) {
@ -219,8 +224,6 @@ public class BukkitPlayer extends PlotPlayer {
this.player.setPlayerWeather(WeatherType.DOWNFALL);
break;
case RESET:
this.player.resetPlayerWeather();
break;
default:
this.player.resetPlayerWeather();
break;
@ -254,8 +257,6 @@ public class BukkitPlayer extends PlotPlayer {
this.player.setGameMode(GameMode.SPECTATOR);
break;
case SURVIVAL:
this.player.setGameMode(GameMode.SURVIVAL);
break;
default:
this.player.setGameMode(GameMode.SURVIVAL);
break;

View File

@ -1,7 +1,12 @@
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import org.bukkit.*;
import org.bukkit.Art;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Rotation;
import org.bukkit.TreeSpecies;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.*;
import org.bukkit.inventory.EntityEquipment;
@ -576,14 +581,6 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
restoreAgeable((Ageable) entity);
restoreLiving((LivingEntity) entity);
return entity;
case GUARDIAN:
case ELDER_GUARDIAN:
restoreLiving((LivingEntity) entity);
return entity;
case SKELETON:
case WITHER_SKELETON:
restoreLiving((LivingEntity) entity);
return entity;
case ARMOR_STAND:
// CHECK positions
ArmorStand stand = (ArmorStand) entity;
@ -679,6 +676,10 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
case BLAZE:
case SNOWMAN:
case SHULKER:
case GUARDIAN:
case ELDER_GUARDIAN:
case SKELETON:
case WITHER_SKELETON:
restoreLiving((LivingEntity) entity);
return entity;
case IRON_GOLEM:

View File

@ -1,15 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.titles;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle;
import org.bukkit.entity.Player;
public class DefaultTitle extends AbstractTitle {
@Override
public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) {
final Player playerObj = ((BukkitPlayer) player).player;
playerObj.sendTitle(head, sub, in, delay, out);
}
}

View File

@ -249,13 +249,6 @@ public interface IPlotMain extends ILogger {
*/
@NotNull IndependentPlotGenerator getDefaultGenerator();
/**
* Gets the class that will manage player titles.
*
* @return
*/
AbstractTitle initTitleManager();
List<String> getPluginIds();
BlockRegistry<?> getBlockRegistry();

View File

@ -188,8 +188,6 @@ import java.util.zip.ZipInputStream;
ChunkManager.manager = this.IMP.initChunkManager();
// Schematic handler
SchematicHandler.manager = this.IMP.initSchematicHandler();
// Titles
AbstractTitle.TITLE_CLASS = this.IMP.initTitleManager();
// Chat
ChatManager.manager = this.IMP.initChatManager();
// Commands

View File

@ -17,12 +17,21 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
import com.google.common.io.Files;
import javax.script.*;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.script.SimpleScriptContext;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
@CommandDeclaration(command = "debugexec", permission = "plots.admin",
description = "Mutli-purpose debug command", aliases = {"exec", "$"},
@ -107,7 +116,6 @@ import java.util.*;
this.scope.put("WEManager", new WEManager());
}
this.scope.put("TaskManager", TaskManager.IMP);
this.scope.put("TitleManager", AbstractTitle.TITLE_CLASS);
this.scope.put("ConsolePlayer", ConsolePlayer.getConsole());
this.scope.put("SchematicHandler", SchematicHandler.manager);
this.scope.put("ChunkManager", ChunkManager.manager);

View File

@ -5,12 +5,22 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flag.*;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.flag.IntegerFlag;
import com.github.intellectualsites.plotsquared.plot.flag.ListFlag;
import com.github.intellectualsites.plotsquared.plot.flag.PlotBlockListFlag;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.*;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import java.util.*;
@ -284,9 +294,7 @@ import java.util.*;
HashMap<String, ArrayList<String>> flags = new HashMap<>();
for (Flag<?> flag1 : Flags.getFlags()) {
String type = flag1.getClass().getSimpleName();
if (!flags.containsKey(type)) {
flags.put(type, new ArrayList<>());
}
flags.computeIfAbsent(type, k -> new ArrayList<>());
flags.get(type).add(flag1.getName());
}
StringBuilder message = new StringBuilder();

View File

@ -209,8 +209,7 @@ public class ListCmd extends SubCommand {
int p1s = p1.getSettings().getRatings().size();
int p2s = p2.getRatings().size();
if (!p1.getSettings().getRatings().isEmpty()) {
v1 = p1.getRatings().entrySet().stream()
.mapToDouble(entry -> entry.getValue().getAverageRating())
v1 = p1.getRatings().values().stream().mapToDouble(Rating::getAverageRating)
.map(av -> av * av).sum();
v1 /= p1s;
v1 += p1s;

View File

@ -3,8 +3,17 @@ package com.github.intellectualsites.plotsquared.plot.commands;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.util.*;
import com.github.intellectualsites.plotsquared.plot.object.Expression;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import java.util.UUID;
@ -59,8 +68,7 @@ public class Merge extends SubCommand {
}
}
final PlotArea plotArea = plot.getArea();
Expression<Double> priceExr =
plotArea.PRICES.containsKey("merge") ? plotArea.PRICES.get("merge") : null;
Expression<Double> priceExr = plotArea.PRICES.getOrDefault("merge", null);
final int size = plot.getConnectedPlots().size();
final double price = priceExr == null ? 0d : priceExr.evaluate((double) size);
if (EconHandler.manager != null && plotArea.USE_ECONOMY && price > 0d
@ -97,9 +105,9 @@ public class Merge extends SubCommand {
terrain = "true".equalsIgnoreCase(args[1]);
}
if (!terrain && !Permissions
.hasPermission(player, Captions.PERMISSION_MERGE_KEEPROAD)) {
.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_MERGE_KEEPROAD.s());
Captions.PERMISSION_MERGE_KEEP_ROAD.s());
return true;
}
if (plot.autoMerge(-1, maxSize, uuid, terrain)) {
@ -134,9 +142,9 @@ public class Merge extends SubCommand {
} else {
terrain = true;
}
if (!terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEPROAD)) {
if (!terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_MERGE_KEEPROAD.s());
Captions.PERMISSION_MERGE_KEEP_ROAD.s());
return true;
}
if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) {

View File

@ -5,7 +5,11 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.*;
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import java.util.Set;
import java.util.UUID;
@ -34,7 +38,7 @@ import java.util.UUID;
if (value.equalsIgnoreCase("none") || value.equalsIgnoreCase("null") || value
.equalsIgnoreCase("-")) {
if (!Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SETOWNER.s(), true)) {
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER.s(), true)) {
return false;
}
Set<Plot> connected = plot.getConnectedPlots();
@ -54,7 +58,7 @@ import java.util.UUID;
Captions.ALREADY_OWNER.send(player, MainUtil.getName(uuid));
return false;
}
if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SETOWNER)) {
if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER)) {
if (other == null) {
Captions.INVALID_PLAYER_OFFLINE.send(player, value);
return false;

View File

@ -60,8 +60,8 @@ public enum Captions {
PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"),
PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield", "static.permissions"),
PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"),
PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"),
PERMISSION_MERGE_KEEPROAD("plots.merge.keeproad", "static.permissions"),
PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), PERMISSION_MERGE_KEEP_ROAD(
"plots.merge.keeproad", "static.permissions"),
PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"),
PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel", "static.permissions"),
PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other", "static.permissions"),
@ -71,8 +71,8 @@ public enum Captions {
PERMISSION_ADMIN_BUILD_OTHER("plots.admin.build.other", "static.permissions"),
PERMISSION_ADMIN_INTERACT_ROAD("plots.admin.interact.road", "static.permissions"),
PERMISSION_ADMIN_INTERACT_UNOWNED("plots.admin.interact.unowned", "static.permissions"),
PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"),
PERMISSION_ADMIN_BUILD_HEIGHTLIMIT("plots.admin.build.heightlimit", "static.permissions"),
PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT(
"plots.admin.build.heightlimit", "static.permissions"),
PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"),
PERMISSION_ADMIN_COMMAND_RATE("plots.admin.command.rate", "static.permissions"),
PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust", "static.permissions"),
@ -141,8 +141,8 @@ public enum Captions {
PERMISSION_LIST_FUZZY("plots.list.fuzzy", "static.permissions"),
PERMISSION_LIST_AREA("plots.list.area", "static.permissions"),
PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", "static.permissions"),
PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"),
PERMISSION_ADMIN_COMMAND_SETOWNER("plots.admin.command.setowner", "static.permissions"),
PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"), PERMISSION_ADMIN_COMMAND_SET_OWNER(
"plots.admin.command.setowner", "static.permissions"),
PERMISSION_COMMENT("plots.comment", "static.permissions"),
PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", "static.permissions"),
PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", "static.permissions"),

View File

@ -2538,11 +2538,7 @@ import java.util.concurrent.atomic.AtomicInteger;
id = resultSet.getInt("id");
String areaid = resultSet.getString("world");
if (!areas.contains(areaid)) {
if (noExist.containsKey(areaid)) {
noExist.put(areaid, noExist.get(areaid) + 1);
} else {
noExist.put(areaid, 1);
}
noExist.merge(areaid, 1, Integer::sum);
}
owner = resultSet.getString("owner");
user = uuids.get(owner);

View File

@ -5,7 +5,12 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.*;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import com.github.intellectualsites.plotsquared.plot.util.*;
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
@ -171,7 +176,7 @@ public class PlotListener {
.replaceFromMap(Captions.TITLE_ENTERED_PLOT.s(), replacements);
String sub = StringMan
.replaceFromMap(Captions.TITLE_ENTERED_PLOT_SUB.s(), replacements);
AbstractTitle.sendTitle(player, main, sub);
player.sendTitle(main, sub);
}
}, 20);
}

View File

@ -38,6 +38,10 @@ public class ConsolePlayer extends PlotPlayer {
return true;
}
@Override
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
}
@Override public Location getLocation() {
return this.getMeta("location");
}

View File

@ -1360,9 +1360,7 @@ public class Plot {
public Map<UUID, Boolean> getLikes() {
final Map<UUID, Boolean> map = new HashMap<>();
final Map<UUID, Rating> ratings = this.getRatings();
ratings.forEach((uuid, rating) -> {
map.put(uuid, rating.getLike());
});
ratings.forEach((uuid, rating) -> map.put(uuid, rating.getLike()));
return map;
}

View File

@ -16,7 +16,11 @@ import lombok.NonNull;
import javax.annotation.Nonnull;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -340,6 +344,15 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
return result;
}
public void sendTitle(String title, String subtitle) {
sendTitle(title, subtitle, 1, 2, 1);
}
;
public abstract void sendTitle(String title, String subtitle, int fadeIn, int stay,
int fadeOut);
/**
* Teleport this player to a location.
*

View File

@ -5,7 +5,6 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.stream.IntStream;
public class Rating {
@ -55,7 +54,7 @@ public class Rating {
if (Settings.Ratings.USE_LIKES) {
return getLike() ? 10 : 1;
}
double total = this.ratingMap.entrySet().stream().mapToDouble(Entry::getValue).sum();
double total = this.ratingMap.values().stream().mapToDouble(v -> v).sum();
return total / this.ratingMap.size();
}

View File

@ -1,20 +0,0 @@
package com.github.intellectualsites.plotsquared.plot.util;
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
public abstract class AbstractTitle {
public static AbstractTitle TITLE_CLASS;
public static void sendTitle(PlotPlayer player, String head, String sub) {
if (player instanceof ConsolePlayer) {
return;
}
if (TITLE_CLASS != null && !player.getAttribute("disabletitles")) {
TITLE_CLASS.sendTitle(player, head, sub, 1, 2, 1);
}
}
public abstract void sendTitle(PlotPlayer player, String head, String sub, int in, int delay,
int out);
}

View File

@ -136,7 +136,7 @@ public abstract class ChunkManager {
}
/**
* The int[] will be in the form: [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge] and will represent the bottom and top parts of the chunk
* The int[] will be in the form: [chunkX, chunkZ, pos1x, pos1z, pos2x, pos2z, isEdge] and will represent the bottom and top parts of the chunk
*
* @param pos1
* @param pos2

View File

@ -5,7 +5,11 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import com.github.intellectualsites.plotsquared.plot.object.comment.*;
import com.github.intellectualsites.plotsquared.plot.object.comment.CommentInbox;
import com.github.intellectualsites.plotsquared.plot.object.comment.InboxOwner;
import com.github.intellectualsites.plotsquared.plot.object.comment.InboxPublic;
import com.github.intellectualsites.plotsquared.plot.object.comment.InboxReport;
import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment;
import java.util.Collection;
import java.util.HashMap;
@ -40,7 +44,7 @@ public class CommentManager {
total = count.get();
}
if ((size.decrementAndGet() == 0) && (total > 0)) {
AbstractTitle.sendTitle(player, "",
player.sendTitle("",
Captions.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total));
}
}

View File

@ -34,8 +34,6 @@ public class ConsoleColors {
public static ConsoleColor chatColor(final String color) {
switch (color) {
case "&r":
return ConsoleColor.RESET;
case "&7":
case "&8":
return ConsoleColor.WHITE;
@ -65,6 +63,7 @@ public class ConsoleColors {
return ConsoleColor.ITALIC;
case "&l":
return ConsoleColor.BOLD;
case "&r":
default:
return ConsoleColor.RESET;
}

View File

@ -15,9 +15,6 @@ import lombok.experimental.UtilityClass;
private static int capNumeral(@NonNull final String flagName) {
int i;
switch (flagName) {
case "entity-cap":
i = 0;
break;
case "mob-cap":
i = 3;
break;
@ -33,6 +30,7 @@ import lombok.experimental.UtilityClass;
case "misc-cap":
i = 5;
break;
case "entity-cap":
default:
i = 0;
}

View File

@ -51,9 +51,7 @@ import java.util.Map;
private BlockBucket blockListToBucket(@NonNull final PlotBlock[] blocks) {
final Map<PlotBlock, Integer> counts = new HashMap<>();
for (final PlotBlock block : blocks) {
if (!counts.containsKey(block)) {
counts.put(block, 0);
}
counts.putIfAbsent(block, 0);
counts.put(block, counts.get(block) + 1);
}
boolean includeRatios = false;
@ -66,7 +64,7 @@ import java.util.Map;
final BlockBucket bucket = new BlockBucket();
if (includeRatios) {
for (final Map.Entry<PlotBlock, Integer> count : counts.entrySet()) {
bucket.addBlock(count.getKey(), (int) (count.getValue()));
bucket.addBlock(count.getKey(), count.getValue());
}
} else {
counts.keySet().forEach(bucket::addBlock);