mirror of
https://github.com/filoghost/ChestCommands.git
synced 2025-02-16 19:41:47 +01:00
General cleanup
This commit is contained in:
parent
0dab4c277d
commit
1aaba0eefb
2
.github/ISSUE_TEMPLATE/1-bug.md
vendored
2
.github/ISSUE_TEMPLATE/1-bug.md
vendored
@ -5,7 +5,7 @@ labels: Bug
|
|||||||
---
|
---
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
⚠️ READ BELOW BEFOR SUBMITTING ⚠️
|
⚠️ READ BELOW BEFORE SUBMITTING ⚠️
|
||||||
|
|
||||||
Before opening a bug report:
|
Before opening a bug report:
|
||||||
* Read the FAQ: https://filoghost.me/docs/chest-commands/faq
|
* Read the FAQ: https://filoghost.me/docs/chest-commands/faq
|
||||||
|
2
.github/ISSUE_TEMPLATE/2-feature.md
vendored
2
.github/ISSUE_TEMPLATE/2-feature.md
vendored
@ -5,7 +5,7 @@ labels: Enhancement
|
|||||||
---
|
---
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
⚠️ READ BELOW BEFOR SUBMITTING ⚠️
|
⚠️ READ BELOW BEFORE SUBMITTING ⚠️
|
||||||
|
|
||||||
Please only suggest changes that would benefit many users, not just a specific situation.
|
Please only suggest changes that would benefit many users, not just a specific situation.
|
||||||
|
|
||||||
|
2
.github/ISSUE_TEMPLATE/3-help.md
vendored
2
.github/ISSUE_TEMPLATE/3-help.md
vendored
@ -5,7 +5,7 @@ labels: Help
|
|||||||
---
|
---
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
⚠️ READ BELOW BEFOR SUBMITTING ⚠️
|
⚠️ READ BELOW BEFORE SUBMITTING ⚠️
|
||||||
|
|
||||||
Before asking for help:
|
Before asking for help:
|
||||||
* Read the documentation: https://filoghost.me/docs/chest-commands
|
* Read the documentation: https://filoghost.me/docs/chest-commands
|
||||||
|
2
.github/ISSUE_TEMPLATE/4-documentation.md
vendored
2
.github/ISSUE_TEMPLATE/4-documentation.md
vendored
@ -5,7 +5,7 @@ labels: Documentation
|
|||||||
---
|
---
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
⚠️ READ BELOW BEFOR SUBMITTING ⚠️
|
⚠️ READ BELOW BEFORE SUBMITTING ⚠️
|
||||||
|
|
||||||
You MUST fill out the template below, without modifying or deleting the existing text, otherwise the issue will be automatically closed.
|
You MUST fill out the template below, without modifying or deleting the existing text, otherwise the issue will be automatically closed.
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ public class PlaySoundAction extends Action {
|
|||||||
try {
|
try {
|
||||||
pitch = Float.parseFloat(split[1]);
|
pitch = Float.parseFloat(split[1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +53,7 @@ public class PlaySoundAction extends Action {
|
|||||||
try {
|
try {
|
||||||
volume = Float.parseFloat(split[2]);
|
volume = Float.parseFloat(split[2]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class CommandHandler extends CommandFramework {
|
|||||||
CommandValidate.isTrue(sender.hasPermission(Permissions.COMMAND_BASE + "open"), "You don't have permission.");
|
CommandValidate.isTrue(sender.hasPermission(Permissions.COMMAND_BASE + "open"), "You don't have permission.");
|
||||||
CommandValidate.minLength(args, 2, "Usage: /" + label + " open <menu> [player]");
|
CommandValidate.minLength(args, 2, "Usage: /" + label + " open <menu> [player]");
|
||||||
|
|
||||||
Player target = null;
|
Player target;
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
if (args.length > 2) {
|
if (args.length > 2) {
|
||||||
|
@ -41,6 +41,7 @@ public class AsciiPlaceholders {
|
|||||||
public static void load(ErrorCollector errorCollector) throws IOException, Exception {
|
public static void load(ErrorCollector errorCollector) throws IOException, Exception {
|
||||||
|
|
||||||
placeholders.clear();
|
placeholders.clear();
|
||||||
|
|
||||||
File file = new File(ChestCommands.getInstance().getDataFolder(), "placeholders.yml");
|
File file = new File(ChestCommands.getInstance().getDataFolder(), "placeholders.yml");
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
*/
|
*/
|
||||||
package me.filoghost.chestcommands.config;
|
package me.filoghost.chestcommands.config;
|
||||||
|
|
||||||
import me.filoghost.chestcommands.config.yaml.PluginConfig;
|
|
||||||
import me.filoghost.chestcommands.config.yaml.SpecialConfig;
|
import me.filoghost.chestcommands.config.yaml.SpecialConfig;
|
||||||
|
|
||||||
public class Lang extends SpecialConfig {
|
public class Lang extends SpecialConfig {
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
*/
|
*/
|
||||||
package me.filoghost.chestcommands.config;
|
package me.filoghost.chestcommands.config;
|
||||||
|
|
||||||
import me.filoghost.chestcommands.config.yaml.PluginConfig;
|
|
||||||
import me.filoghost.chestcommands.config.yaml.SpecialConfig;
|
import me.filoghost.chestcommands.config.yaml.SpecialConfig;
|
||||||
|
|
||||||
public class Settings extends SpecialConfig {
|
public class Settings extends SpecialConfig {
|
||||||
|
@ -14,15 +14,11 @@
|
|||||||
*/
|
*/
|
||||||
package me.filoghost.chestcommands.config.yaml;
|
package me.filoghost.chestcommands.config.yaml;
|
||||||
|
|
||||||
import me.filoghost.chestcommands.ChestCommands;
|
|
||||||
import me.filoghost.chestcommands.legacy.ConfigConverter;
|
|
||||||
import me.filoghost.chestcommands.util.FormatUtils;
|
import me.filoghost.chestcommands.util.FormatUtils;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
@ -35,7 +35,7 @@ public class PermissionChecker implements Requirement {
|
|||||||
negated = false;
|
negated = false;
|
||||||
} else {
|
} else {
|
||||||
if (permission.startsWith("-")) {
|
if (permission.startsWith("-")) {
|
||||||
this.permission = permission.substring(1, permission.length());
|
this.permission = permission.substring(1);
|
||||||
negated = true;
|
negated = true;
|
||||||
} else {
|
} else {
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
|
@ -25,9 +25,9 @@ public enum ClickType {
|
|||||||
public static ClickType fromOptions(boolean left, boolean right) {
|
public static ClickType fromOptions(boolean left, boolean right) {
|
||||||
if (left && right) {
|
if (left && right) {
|
||||||
return BOTH;
|
return BOTH;
|
||||||
} else if (left && !right) {
|
} else if (left) {
|
||||||
return LEFT;
|
return LEFT;
|
||||||
} else if (!left && right) {
|
} else if (right) {
|
||||||
return RIGHT;
|
return RIGHT;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -67,7 +67,7 @@ public final class ItemMetaParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Pattern> parseBannerPatternList(List<String> input) throws ParseException {
|
public static List<Pattern> parseBannerPatternList(List<String> input) throws ParseException {
|
||||||
List<Pattern> patterns = new ArrayList<Pattern>();
|
List<Pattern> patterns = new ArrayList<>();
|
||||||
for (String str : input) {
|
for (String str : input) {
|
||||||
String[] split = Strings.trimmedSplit(str, ":");
|
String[] split = Strings.trimmedSplit(str, ":");
|
||||||
if (split.length != 2) {
|
if (split.length != 2) {
|
||||||
|
@ -23,7 +23,7 @@ import me.filoghost.chestcommands.util.Strings;
|
|||||||
|
|
||||||
public class ItemStackParser {
|
public class ItemStackParser {
|
||||||
|
|
||||||
private Material material = Material.STONE; // In the worst case (bad exception handling) we just get stone
|
private final Material material;
|
||||||
private int amount = 1;
|
private int amount = 1;
|
||||||
private short durability = 0;
|
private short durability = 0;
|
||||||
private boolean hasExplicitDurability = false;
|
private boolean hasExplicitDurability = false;
|
||||||
|
@ -22,7 +22,7 @@ public class CaseInsensitiveMap<V> extends HashMap<String, V> {
|
|||||||
private static final long serialVersionUID = 4712822893326841081L;
|
private static final long serialVersionUID = 4712822893326841081L;
|
||||||
|
|
||||||
public static <K> CaseInsensitiveMap<K> create() {
|
public static <K> CaseInsensitiveMap<K> create() {
|
||||||
return new CaseInsensitiveMap<K>();
|
return new CaseInsensitiveMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,22 +66,22 @@ public final class Strings {
|
|||||||
String s = input.toLowerCase();
|
String s = input.toLowerCase();
|
||||||
|
|
||||||
int strLen = s.length();
|
int strLen = s.length();
|
||||||
StringBuffer buffer = new StringBuffer(strLen);
|
StringBuilder output = new StringBuilder(strLen);
|
||||||
boolean capitalizeNext = true;
|
boolean capitalizeNext = true;
|
||||||
for (int i = 0; i < strLen; i++) {
|
for (int i = 0; i < strLen; i++) {
|
||||||
char ch = s.charAt(i);
|
char ch = s.charAt(i);
|
||||||
|
|
||||||
if (Character.isWhitespace(ch)) {
|
if (Character.isWhitespace(ch)) {
|
||||||
buffer.append(ch);
|
output.append(ch);
|
||||||
capitalizeNext = true;
|
capitalizeNext = true;
|
||||||
} else if (capitalizeNext) {
|
} else if (capitalizeNext) {
|
||||||
buffer.append(Character.toTitleCase(ch));
|
output.append(Character.toTitleCase(ch));
|
||||||
capitalizeNext = false;
|
capitalizeNext = false;
|
||||||
} else {
|
} else {
|
||||||
buffer.append(ch);
|
output.append(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buffer.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNullOrEmpty(String s) {
|
public static boolean isNullOrEmpty(String s) {
|
||||||
|
@ -14,11 +14,11 @@ public final class NBTCompound extends NBTTag {
|
|||||||
private final Map<String, NBTTag> value;
|
private final Map<String, NBTTag> value;
|
||||||
|
|
||||||
public NBTCompound(Map<String, NBTTag> value) {
|
public NBTCompound(Map<String, NBTTag> value) {
|
||||||
this.value = new LinkedHashMap<String, NBTTag>(value);
|
this.value = new LinkedHashMap<>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTCompound() {
|
public NBTCompound() {
|
||||||
this.value = new LinkedHashMap<String, NBTTag>();
|
this.value = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// GETTERS
|
// GETTERS
|
||||||
|
@ -9,7 +9,7 @@ public final class NBTList extends NBTTag implements Iterable<NBTTag>, Cloneable
|
|||||||
|
|
||||||
private NBTType type;
|
private NBTType type;
|
||||||
|
|
||||||
private final List<NBTTag> list = new ArrayList<NBTTag>();
|
private final List<NBTTag> list = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the list with a type and a series of elements.
|
* Creates the list with a type and a series of elements.
|
||||||
|
@ -230,7 +230,7 @@ public final class MojangsonParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Number[] parseNumArray(NBTType arrayType, NBTType primType) throws MojangsonParseException {
|
private Number[] parseNumArray(NBTType arrayType, NBTType primType) throws MojangsonParseException {
|
||||||
List<Number> result = new ArrayList<Number>();
|
List<Number> result = new ArrayList<>();
|
||||||
while (currentChar() != ']') {
|
while (currentChar() != ']') {
|
||||||
NBTTag element = parseAnything();
|
NBTTag element = parseAnything();
|
||||||
NBTType elementType = element.getType();
|
NBTType elementType = element.getType();
|
||||||
@ -254,7 +254,7 @@ public final class MojangsonParser {
|
|||||||
}
|
}
|
||||||
expectChar(']');
|
expectChar(']');
|
||||||
|
|
||||||
return result.toArray(new Number[result.size()]);
|
return result.toArray(new Number[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHARACTER NAVIGATION
|
// CHARACTER NAVIGATION
|
||||||
|
@ -18,7 +18,7 @@ public class RelativeStringList {
|
|||||||
if (list != null) {
|
if (list != null) {
|
||||||
this.originalList = ImmutableList.copyOf(list);
|
this.originalList = ImmutableList.copyOf(list);
|
||||||
this.relativeList = Utils.transform(list, RelativeString::of);
|
this.relativeList = Utils.transform(list, RelativeString::of);
|
||||||
this.hasVariables = this.relativeList.stream().anyMatch(element -> element.hasVariables());
|
this.hasVariables = this.relativeList.stream().anyMatch(RelativeString::hasVariables);
|
||||||
} else {
|
} else {
|
||||||
this.originalList = null;
|
this.originalList = null;
|
||||||
this.relativeList = null;
|
this.relativeList = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user