mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
Small changes
This commit is contained in:
@ -249,11 +249,11 @@ public abstract class Command {
|
||||
}
|
||||
if (page == 0 && totalPages != 0) { // Next
|
||||
new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1")
|
||||
.command(baseCommand + " " + (0 + 2)).text(Captions.CLICKABLE.s()).color("$2")
|
||||
.command(baseCommand + " " + 2).text(Captions.CLICKABLE.s()).color("$2")
|
||||
.send(player);
|
||||
return;
|
||||
}
|
||||
if (page == totalPages && totalPages != 0) { // Back
|
||||
if (totalPages != 0) { // Back
|
||||
new PlotMessage().text("<-").color("$1").command(baseCommand + " " + page).text(" | ")
|
||||
.color("$3").text("->").color("$3").text(Captions.CLICKABLE.s()).color("$2")
|
||||
.send(player);
|
||||
@ -387,7 +387,7 @@ public abstract class Command {
|
||||
String[] split = usage[i].split("\\|| |\\>|\\<|\\[|\\]|\\{|\\}|\\_|\\/");
|
||||
for (String aSplit : split) {
|
||||
for (String arg : args) {
|
||||
if (StringMan.isEqualIgnoreCase(arg, aSplit)) {
|
||||
if (arg.equalsIgnoreCase(aSplit)) {
|
||||
count += 5 - i + require;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class Help extends Command {
|
||||
|
||||
CommandCategory catEnum = null;
|
||||
if (cat != null) {
|
||||
if (!StringMan.isEqualIgnoreCase(cat, "all")) {
|
||||
if (!"all".equalsIgnoreCase(cat)) {
|
||||
for (CommandCategory c : CommandCategory.values()) {
|
||||
if (StringMan.isEqualIgnoreCaseToAny(cat, c.name(), c.toString())) {
|
||||
catEnum = c;
|
||||
|
@ -16,7 +16,6 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
@ -348,12 +347,7 @@ public class ListCmd extends SubCommand {
|
||||
public void displayPlots(final PlotPlayer player, List<Plot> plots, int pageSize, int page,
|
||||
PlotArea area, String[] args, boolean sort) {
|
||||
// Header
|
||||
Iterator<Plot> iterator = plots.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
if (!iterator.next().isBasePlot()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
plots.removeIf(plot -> !plot.isBasePlot());
|
||||
if (sort) {
|
||||
plots = PlotSquared.get().sortPlots(plots, SortType.CREATION_DATE, area);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class FlatRandomCollection<T> extends RandomCollection<T> {
|
||||
super(weights, random);
|
||||
int max = 0;
|
||||
int[] counts = new int[weights.size()];
|
||||
Double[] weightDoubles = weights.values().toArray(new Double[weights.size()]);
|
||||
Double[] weightDoubles = weights.values().toArray(new Double[0]);
|
||||
for (int i = 0; i < weightDoubles.length; i++) {
|
||||
int weight = (int) (weightDoubles[i] * 100);
|
||||
counts[i] = weight;
|
||||
|
@ -500,7 +500,7 @@ public class MainUtil {
|
||||
}
|
||||
for (Plot p : plots) {
|
||||
String name = p.getAlias();
|
||||
if (!name.isEmpty() && StringMan.isEqualIgnoreCase(name, arg)) {
|
||||
if (!name.isEmpty() && name.equalsIgnoreCase(arg)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,15 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
public class StringMan {
|
||||
|
||||
@ -145,12 +152,7 @@ public class StringMan {
|
||||
|
||||
public static String joinOrdered(Collection<?> collection, String delimiter) {
|
||||
Object[] array = collection.toArray();
|
||||
Arrays.sort(array, new Comparator<Object>() {
|
||||
@Override public int compare(Object a, Object b) {
|
||||
return a.hashCode() - b.hashCode();
|
||||
}
|
||||
|
||||
});
|
||||
Arrays.sort(array, Comparator.comparingInt(Object::hashCode));
|
||||
return join(array, delimiter);
|
||||
}
|
||||
|
||||
@ -186,8 +188,8 @@ public class StringMan {
|
||||
n = m;
|
||||
m = t.length();
|
||||
}
|
||||
int p[] = new int[n + 1];
|
||||
int d[] = new int[n + 1];
|
||||
int[] p = new int[n + 1];
|
||||
int[] d = new int[n + 1];
|
||||
int i;
|
||||
for (i = 0; i <= n; i++) {
|
||||
p[i] = i;
|
||||
@ -235,9 +237,9 @@ public class StringMan {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEqualIgnoreCaseToAny(String a, String... args) {
|
||||
public static boolean isEqualIgnoreCaseToAny(@NotNull String a, String... args) {
|
||||
for (String arg : args) {
|
||||
if (StringMan.isEqualIgnoreCase(a, arg)) {
|
||||
if (a.equalsIgnoreCase(arg)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ public abstract class UUIDHandlerImplementation {
|
||||
protected UUIDWrapper uuidWrapper;
|
||||
private boolean cached = false;
|
||||
private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<>());
|
||||
// private BiMap<UUID, StringWrapper> nameMap = uuidMap.inverse();
|
||||
|
||||
public UUIDHandlerImplementation(UUIDWrapper wrapper) {
|
||||
this.uuidWrapper = wrapper;
|
||||
|
Reference in New Issue
Block a user