mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-26 02:57:59 +01:00
Fixed some code smells
This commit is contained in:
parent
cae214f856
commit
7248fb3e14
@ -36,7 +36,7 @@ public class AddonClassLoader extends URLClassLoader {
|
||||
MalformedURLException,
|
||||
InvalidDescriptionException,
|
||||
InstantiationException,
|
||||
IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
|
||||
IllegalAccessException, InvocationTargetException, NoSuchMethodException {
|
||||
super(new URL[]{path.toURI().toURL()}, parent);
|
||||
|
||||
loader = addonsManager;
|
||||
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
@ -47,7 +48,7 @@ public class AdminWhyCommand extends ConfirmableCommand {
|
||||
}
|
||||
// Determine the debug mode and toggle if required
|
||||
boolean newValue = !target.getPlayer().getMetadata(getWorld().getName() + "_why_debug").stream()
|
||||
.filter(p -> p.getOwningPlugin().equals(getPlugin())).findFirst().map(p -> p.asBoolean()).orElse(false);
|
||||
.filter(p -> p.getOwningPlugin().equals(getPlugin())).findFirst().map(MetadataValue::asBoolean).orElse(false);
|
||||
if (newValue) {
|
||||
user.sendMessage("commands.admin.why.turning-on", TextVariables.NAME, target.getName());
|
||||
} else {
|
||||
|
@ -20,8 +20,8 @@ public class AdminSchemCommand extends ConfirmableCommand {
|
||||
|
||||
// Map containing selection cuboid display tasks
|
||||
private Map<User, Integer> display;
|
||||
private final Particle PARTICLE = Particle.REDSTONE;
|
||||
private final Particle.DustOptions PARTICLE_DUST_OPTIONS = new Particle.DustOptions(Color.RED, 1.0F);
|
||||
private static final Particle PARTICLE = Particle.REDSTONE;
|
||||
private static final Particle.DustOptions PARTICLE_DUST_OPTIONS = new Particle.DustOptions(Color.RED, 1.0F);
|
||||
|
||||
public AdminSchemCommand(CompositeCommand parent) {
|
||||
super(parent, "schem");
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
@ -30,7 +31,6 @@ public abstract class AbstractFlagListener implements Listener {
|
||||
*
|
||||
*/
|
||||
enum Why {
|
||||
|
||||
UNPROTECTED_WORLD,
|
||||
OP,
|
||||
BYPASS_EVERYWHERE,
|
||||
@ -226,9 +226,9 @@ public abstract class AbstractFlagListener implements Listener {
|
||||
|
||||
private void report(User user, Event e, Location loc, Flag flag, Why why) {
|
||||
if (user != null && user.getPlayer().getMetadata(loc.getWorld().getName() + "_why_debug").stream()
|
||||
.filter(p -> p.getOwningPlugin().equals(getPlugin())).findFirst().map(p -> p.asBoolean()).orElse(false)) {
|
||||
.filter(p -> p.getOwningPlugin().equals(getPlugin())).findFirst().map(MetadataValue::asBoolean).orElse(false)) {
|
||||
plugin.log("Why: " + e.getEventName() + " in world " + loc.getWorld().getName() + " at " + Util.xyz(loc.toVector()));
|
||||
plugin.log("Why: " + (user == null ? "Unknown" : user.getName()) + " " + flag.getID() + " - " + why.name());
|
||||
plugin.log("Why: " + user.getName() + " " + flag.getID() + " - " + why.name());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class IslandWorldManager {
|
||||
*/
|
||||
public Map<String, String> getOverWorldNames() {
|
||||
return worldSettings.values().stream()
|
||||
.collect(Collectors.toMap(ws -> ws.getWorldName(), ws -> ws.getAddon().map(a -> a.getDescription().getName()).orElse("None")));
|
||||
.collect(Collectors.toMap(WorldSettings::getWorldName, ws -> ws.getAddon().map(a -> a.getDescription().getName()).orElse("None")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user