mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-25 13:24:28 +00:00
i prefer this
This commit is contained in:
@ -4,8 +4,6 @@ import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.plugin.PluginDescription;
|
||||
import com.velocitypowered.api.plugin.PluginManager;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import dev.plex.config.TomlConfig;
|
||||
|
@ -60,7 +60,7 @@ public abstract class PlexCommand implements SimpleCommand
|
||||
|
||||
if (commandSource == RequiredCommandSource.CONSOLE && invocation.source() instanceof Player)
|
||||
{
|
||||
// sender.sendMessage(messageComponent("noPermissionInGame"));
|
||||
// sender.sendMessage(messageComponent("noPermissionInGame"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public abstract class PlexCommand implements SimpleCommand
|
||||
{
|
||||
if (invocation.source() instanceof ConsoleCommandSource)
|
||||
{
|
||||
// send(sender, messageComponent("noPermissionConsole"));
|
||||
// send(sender, messageComponent("noPermissionConsole"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ public abstract class PlexCommand implements SimpleCommand
|
||||
return;
|
||||
}
|
||||
}
|
||||
Component component = this.execute(invocation.source(), invocation.source() instanceof ConsoleCommandSource ? null : (Player)invocation.source(), invocation.arguments());
|
||||
Component component = this.execute(invocation.source(), invocation.source() instanceof ConsoleCommandSource ? null : (Player) invocation.source(), invocation.arguments());
|
||||
if (component != null)
|
||||
{
|
||||
send(invocation.source(), component);
|
||||
|
@ -49,7 +49,7 @@ public class ArrayValueReader implements ValueReader
|
||||
Object converted = read(s, index, context);
|
||||
if (converted instanceof dev.plex.toml.Results.Errors)
|
||||
{
|
||||
errors.add((dev.plex.toml.Results.Errors)converted);
|
||||
errors.add((dev.plex.toml.Results.Errors) converted);
|
||||
}
|
||||
else if (!isHomogenousArray(converted, arrayItems))
|
||||
{
|
||||
@ -71,7 +71,7 @@ public class ArrayValueReader implements ValueReader
|
||||
Object converted = ValueReaders.VALUE_READERS.convert(s, index, context);
|
||||
if (converted instanceof dev.plex.toml.Results.Errors)
|
||||
{
|
||||
errors.add((dev.plex.toml.Results.Errors)converted);
|
||||
errors.add((dev.plex.toml.Results.Errors) converted);
|
||||
}
|
||||
else if (!isHomogenousArray(converted, arrayItems))
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public abstract class ArrayValueWriter implements dev.plex.toml.ValueWriter
|
||||
}
|
||||
else
|
||||
{
|
||||
collection = (Collection<Object>)value;
|
||||
collection = (Collection<Object>) value;
|
||||
}
|
||||
|
||||
return collection;
|
||||
@ -70,7 +70,7 @@ public abstract class ArrayValueWriter implements dev.plex.toml.ValueWriter
|
||||
}
|
||||
else
|
||||
{
|
||||
Collection<?> collection = (Collection<?>)value;
|
||||
Collection<?> collection = (Collection<?>) value;
|
||||
if (collection.size() > 0)
|
||||
{
|
||||
return collection.iterator().next();
|
||||
|
@ -74,11 +74,11 @@ public abstract class Container
|
||||
{
|
||||
if (entry.getValue() instanceof Table)
|
||||
{
|
||||
entry.setValue(((Table)entry.getValue()).consume());
|
||||
entry.setValue(((Table) entry.getValue()).consume());
|
||||
}
|
||||
else if (entry.getValue() instanceof TableArray)
|
||||
{
|
||||
entry.setValue(((TableArray)entry.getValue()).getValues());
|
||||
entry.setValue(((TableArray) entry.getValue()).getValues());
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ public abstract class Container
|
||||
@Override
|
||||
void put(String key, Object value)
|
||||
{
|
||||
values.add((Table)value);
|
||||
values.add((Table) value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,7 +37,7 @@ class InlineTableValueReader implements dev.plex.toml.ValueReader
|
||||
|
||||
if (converted instanceof dev.plex.toml.Results.Errors)
|
||||
{
|
||||
errors.add((dev.plex.toml.Results.Errors)converted);
|
||||
errors.add((dev.plex.toml.Results.Errors) converted);
|
||||
return errors;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class MapValueWriter implements dev.plex.toml.ValueWriter
|
||||
file = context.file;
|
||||
}
|
||||
|
||||
Map<?, ?> from = (Map<?, ?>)value;
|
||||
Map<?, ?> from = (Map<?, ?>) value;
|
||||
|
||||
Toml toml = null;
|
||||
|
||||
|
@ -175,7 +175,7 @@ class Results
|
||||
startTables(dev.plex.toml.Identifier.from(path, null), line);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> valueMap = (Map<String, Object>)value;
|
||||
Map<String, Object> valueMap = (Map<String, Object>) value;
|
||||
for (Map.Entry<String, Object> entry : valueMap.entrySet())
|
||||
{
|
||||
addValue(entry.getKey(), entry.getValue(), line);
|
||||
@ -215,7 +215,7 @@ class Results
|
||||
|
||||
if (currentContainer.get(tablePart) instanceof Container.TableArray)
|
||||
{
|
||||
Container.TableArray currentTableArray = (Container.TableArray)currentContainer.get(tablePart);
|
||||
Container.TableArray currentTableArray = (Container.TableArray) currentContainer.get(tablePart);
|
||||
stack.push(currentTableArray);
|
||||
|
||||
if (i == tableParts.length - 1)
|
||||
@ -228,7 +228,7 @@ class Results
|
||||
}
|
||||
else if (currentContainer.get(tablePart) instanceof Container.Table && i < tableParts.length - 1)
|
||||
{
|
||||
Container nextTable = (Container)currentContainer.get(tablePart);
|
||||
Container nextTable = (Container) currentContainer.get(tablePart);
|
||||
stack.push(nextTable);
|
||||
}
|
||||
else if (currentContainer.accepts(tablePart))
|
||||
@ -239,7 +239,7 @@ class Results
|
||||
|
||||
if (newContainer instanceof Container.TableArray)
|
||||
{
|
||||
stack.push(((Container.TableArray)newContainer).getCurrent());
|
||||
stack.push(((Container.TableArray) newContainer).getCurrent());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -266,7 +266,7 @@ class Results
|
||||
Container currentContainer = stack.peek();
|
||||
if (currentContainer.get(tablePart) instanceof Container)
|
||||
{
|
||||
Container nextTable = (Container)currentContainer.get(tablePart);
|
||||
Container nextTable = (Container) currentContainer.get(tablePart);
|
||||
if (i == tableParts.length - 1 && !nextTable.isImplicit())
|
||||
{
|
||||
errors.duplicateTable(tableName, line.get());
|
||||
@ -275,7 +275,7 @@ class Results
|
||||
stack.push(nextTable);
|
||||
if (stack.peek() instanceof Container.TableArray)
|
||||
{
|
||||
stack.push(((Container.TableArray)stack.peek()).getCurrent());
|
||||
stack.push(((Container.TableArray) stack.peek()).getCurrent());
|
||||
}
|
||||
}
|
||||
else if (currentContainer.accepts(tablePart))
|
||||
@ -298,7 +298,7 @@ class Results
|
||||
Container values = stack.getLast();
|
||||
stack.clear();
|
||||
|
||||
return ((Container.Table)values).consume();
|
||||
return ((Container.Table) values).consume();
|
||||
}
|
||||
|
||||
private Container startTable(String tableName, AtomicInteger line)
|
||||
@ -332,7 +332,7 @@ class Results
|
||||
return null;
|
||||
}
|
||||
|
||||
Container.Table table = (Container.Table)next;
|
||||
Container.Table table = (Container.Table) next;
|
||||
|
||||
if (table.name == null)
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ public class Toml
|
||||
|
||||
public String getString(String key)
|
||||
{
|
||||
return (String)get(key);
|
||||
return (String) get(key);
|
||||
}
|
||||
|
||||
public String getString(String key, String defaultValue)
|
||||
@ -179,7 +179,7 @@ public class Toml
|
||||
|
||||
public Long getLong(String key)
|
||||
{
|
||||
return (Long)get(key);
|
||||
return (Long) get(key);
|
||||
}
|
||||
|
||||
public Long getLong(String key, Long defaultValue)
|
||||
@ -196,7 +196,7 @@ public class Toml
|
||||
public <T> List<T> getList(String key)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
List<T> list = (List<T>)get(key);
|
||||
List<T> list = (List<T>) get(key);
|
||||
|
||||
return list;
|
||||
}
|
||||
@ -216,7 +216,7 @@ public class Toml
|
||||
|
||||
public Boolean getBoolean(String key)
|
||||
{
|
||||
return (Boolean)get(key);
|
||||
return (Boolean) get(key);
|
||||
}
|
||||
|
||||
public Boolean getBoolean(String key, Boolean defaultValue)
|
||||
@ -227,7 +227,7 @@ public class Toml
|
||||
|
||||
public Date getDate(String key)
|
||||
{
|
||||
return (Date)get(key);
|
||||
return (Date) get(key);
|
||||
}
|
||||
|
||||
public Date getDate(String key, Date defaultValue)
|
||||
@ -238,7 +238,7 @@ public class Toml
|
||||
|
||||
public Double getDouble(String key)
|
||||
{
|
||||
return (Double)get(key);
|
||||
return (Double) get(key);
|
||||
}
|
||||
|
||||
public Double getDouble(String key, Double defaultValue)
|
||||
@ -254,7 +254,7 @@ public class Toml
|
||||
@SuppressWarnings("unchecked")
|
||||
public Toml getTable(String key)
|
||||
{
|
||||
Map<String, Object> map = (Map<String, Object>)get(key);
|
||||
Map<String, Object> map = (Map<String, Object>) get(key);
|
||||
|
||||
return map != null ? new Toml(null, map) : null;
|
||||
}
|
||||
@ -266,7 +266,7 @@ public class Toml
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Toml> getTables(String key)
|
||||
{
|
||||
List<Map<String, Object>> tableArray = (List<Map<String, Object>>)get(key);
|
||||
List<Map<String, Object>> tableArray = (List<Map<String, Object>>) get(key);
|
||||
|
||||
if (tableArray == null)
|
||||
{
|
||||
@ -402,7 +402,7 @@ public class Toml
|
||||
}
|
||||
else if (List.class.isAssignableFrom(entryClass))
|
||||
{
|
||||
List<?> value = (List<?>)entry.getValue();
|
||||
List<?> value = (List<?>) entry.getValue();
|
||||
if (!value.isEmpty() && value.get(0) instanceof Map)
|
||||
{
|
||||
entries.add(new Entry(entry.getKey(), getTables(entry.getKey())));
|
||||
@ -466,21 +466,21 @@ public class Toml
|
||||
|
||||
for (dev.plex.toml.Keys.Key k : keys)
|
||||
{
|
||||
if (k.index == -1 && current instanceof Map && ((Map<String, Object>)current).containsKey(k.path))
|
||||
if (k.index == -1 && current instanceof Map && ((Map<String, Object>) current).containsKey(k.path))
|
||||
{
|
||||
return ((Map<String, Object>)current).get(k.path);
|
||||
return ((Map<String, Object>) current).get(k.path);
|
||||
}
|
||||
|
||||
current = ((Map<String, Object>)current).get(k.name);
|
||||
current = ((Map<String, Object>) current).get(k.name);
|
||||
|
||||
if (k.index > -1 && current != null)
|
||||
{
|
||||
if (k.index >= ((List<?>)current).size())
|
||||
if (k.index >= ((List<?>) current).size())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
current = ((List<?>)current).get(k.index);
|
||||
current = ((List<?>) current).get(k.index);
|
||||
}
|
||||
|
||||
if (current == null)
|
||||
|
@ -66,7 +66,7 @@ class TomlParser
|
||||
|
||||
if (value instanceof dev.plex.toml.Results.Errors)
|
||||
{
|
||||
results.errors.add((dev.plex.toml.Results.Errors)value);
|
||||
results.errors.add((dev.plex.toml.Results.Errors) value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public class ReflectionsUtil
|
||||
{
|
||||
if (clazz.getSuperclass() == subType || Arrays.asList(clazz.getInterfaces()).contains(subType))
|
||||
{
|
||||
classes.add((Class<? extends T>)clazz);
|
||||
classes.add((Class<? extends T>) clazz);
|
||||
}
|
||||
});
|
||||
return Collections.unmodifiableSet(classes);
|
||||
|
Reference in New Issue
Block a user