Fixed indent and javadoc from previous commit

This commit is contained in:
Florian CUNY 2019-05-11 14:28:57 +02:00
parent 8ce47772c2
commit b4fe70da0c
2 changed files with 57 additions and 57 deletions

View File

@ -77,7 +77,7 @@ public class Flag implements Comparable<Flag> {
private Set<GameModeAddon> gameModes = new HashSet<>();
private final Addon addon;
private Flag(Builder builder) {
private Flag(Builder builder) {
this.id = builder.id;
this.icon = builder.icon;
this.listener = builder.listener;
@ -171,14 +171,14 @@ public class Flag implements Comparable<Flag> {
public boolean hasSubPanel() {
return subPanel;
}
/**
* Get the addon that made this flag
* @return the addon
* @since 1.5.0
*/
public Addon getAddon() {
return addon;
return addon;
}
/* (non-Javadoc)
@ -296,14 +296,14 @@ public class Flag implements Comparable<Flag> {
}
Island island = plugin.getIslands().getIslandAt(user.getLocation()).orElse(plugin.getIslands().getIsland(user.getWorld(), user.getUniqueId()));
switch(getType()) {
case PROTECTION:
return createProtectionFlag(plugin, user, island, pib).build();
case SETTING:
return createSettingFlag(user, island, pib).build();
case WORLD_SETTING:
return createWorldSettingFlag(user, pib).build();
default:
return pib.build();
case PROTECTION:
return createProtectionFlag(plugin, user, island, pib).build();
case SETTING:
return createSettingFlag(user, island, pib).build();
case WORLD_SETTING:
return createWorldSettingFlag(user, pib).build();
default:
return pib.build();
}
}
@ -345,11 +345,11 @@ public class Flag implements Comparable<Flag> {
@Override
public String toString() {
return "Flag [id=" + id + "]";
}
public String toString() {
return "Flag [id=" + id + "]";
}
@Override
@Override
public int compareTo(Flag o) {
return getID().compareTo(o.getID());
}
@ -381,7 +381,7 @@ public class Flag implements Comparable<Flag> {
// GameModeAddon
private GameModeAddon gameModeAddon;
private Addon addon;
private Addon addon;
/**
* Builder for making flags
@ -463,7 +463,7 @@ public class Flag implements Comparable<Flag> {
this.gameModeAddon = gameModeAddon;
return this;
}
/**
* The addon registering this flag. Ensure this is set to enable the addon to be reloaded.
* @param addon
@ -471,8 +471,8 @@ public class Flag implements Comparable<Flag> {
* @since 1.5.0
*/
public Builder addon(Addon addon) {
this.addon = addon;
return this;
this.addon = addon;
return this;
}
/**
@ -483,18 +483,18 @@ public class Flag implements Comparable<Flag> {
// If no clickHandler has been set, then apply default ones
if (clickHandler == null) {
switch (type){
case PROTECTION:
clickHandler = new CycleClick(id);
break;
case SETTING:
clickHandler = new IslandToggleClick(id);
break;
case WORLD_SETTING:
clickHandler = new WorldToggleClick(id);
break;
default:
clickHandler = new CycleClick(id);
break;
case PROTECTION:
clickHandler = new CycleClick(id);
break;
case SETTING:
clickHandler = new IslandToggleClick(id);
break;
case WORLD_SETTING:
clickHandler = new WorldToggleClick(id);
break;
default:
clickHandler = new CycleClick(id);
break;
}
}

View File

@ -1,22 +1,21 @@
package world.bentobox.bentobox.managers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.lists.Flags;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* @author Poslovitch
* @author tastybento
@ -42,17 +41,18 @@ public class FlagsManager {
}
/**
* Register a new flag.
* Registers a new flag.
* Consider using {@link #registerFlag(Addon, Flag)} instead if your flag declares a listener.
* @param flag flag to be registered
* @return true if successfully registered, false if not, e.g., because one with the same ID already exists
* @see Consider using {@link #registerFlag(Addon, Flag)} instead if your flag declares a listener
* @see #registerFlag(Addon, Flag)
*/
public boolean registerFlag(@NonNull Flag flag) {
return registerFlag(null, flag);
return registerFlag(null, flag);
}
/**
* Register a new flag.
* Registers a new flag.
* @param addon - addon that is registering this flag
* @param flag flag to be registered
* @return true if successfully registered, false if not, e.g., because one with the same ID already exists
@ -70,7 +70,7 @@ public class FlagsManager {
flag.getListener().ifPresent(this::registerListener);
return true;
}
/**
* Register any unregistered listeners.
* This helps to make sure each flag listener is correctly loaded.
@ -110,17 +110,17 @@ public class FlagsManager {
return flags.keySet().stream().filter(flag -> flag.getID().equals(id)).findFirst();
}
/**
* Unregister flags for addon
* @param addon - addon
* @since 1.5.0
*/
public void unregister(@NonNull Addon addon) {
// Unregister listeners
flags.entrySet().stream().filter(e -> addon.equals(e.getValue())).map(Map.Entry::getKey)
.forEach(f -> f.getListener().ifPresent(HandlerList::unregisterAll));
// Remove flags
flags.values().removeIf(addon::equals);
}
/**
* Unregister flags for addon
* @param addon - addon
* @since 1.5.0
*/
public void unregister(@NonNull Addon addon) {
// Unregister listeners
flags.entrySet().stream().filter(e -> addon.equals(e.getValue())).map(Map.Entry::getKey)
.forEach(f -> f.getListener().ifPresent(HandlerList::unregisterAll));
// Remove flags
flags.values().removeIf(addon::equals);
}
}