Fixes quite a lot of warnings
This commit is contained in:
parent
f8407a3692
commit
950faa7100
1
.gitignore
vendored
1
.gitignore
vendored
@ -167,7 +167,6 @@ GitHub.sublime-settings
|
||||
Session.vim
|
||||
# temporary
|
||||
.netrwhist
|
||||
*~
|
||||
# auto-generated tag files
|
||||
tags
|
||||
|
||||
|
10
pom.xml
10
pom.xml
@ -57,7 +57,7 @@
|
||||
<dependency>
|
||||
<groupId>com.massivecraft.massivecore</groupId>
|
||||
<artifactId>MassiveCore</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<version>3.3.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\lib\MassiveCore.jar</systemPath>
|
||||
</dependency>
|
||||
@ -76,12 +76,12 @@
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-core</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<version>7.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<version>7.0.5</version>
|
||||
</dependency>
|
||||
<!-- Vault -->
|
||||
<dependency>
|
||||
@ -93,7 +93,7 @@
|
||||
<dependency>
|
||||
<groupId>com.griefcraft</groupId>
|
||||
<artifactId>lwc</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<version>4.4.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\lib\LWC.jar</systemPath>
|
||||
</dependency>
|
||||
@ -108,7 +108,7 @@
|
||||
<dependency>
|
||||
<groupId>mineverse.Aust1n46.chat</groupId>
|
||||
<artifactId>VentureChat</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<version>3.4.1_1.19_patch</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\lib\VentureChat.jar</systemPath>
|
||||
</dependency>
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.knarcraft.factions;
|
||||
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.util.extractor.Extractor;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
|
||||
public class ExtractorFactionAccountId implements Extractor {
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static ExtractorFactionAccountId i = new ExtractorFactionAccountId();
|
||||
private static final ExtractorFactionAccountId i = new ExtractorFactionAccountId();
|
||||
|
||||
public static ExtractorFactionAccountId get() {
|
||||
return i;
|
||||
@ -22,9 +22,9 @@ public class ExtractorFactionAccountId implements Extractor {
|
||||
public Object extract(Object o) {
|
||||
if (o instanceof Faction) {
|
||||
String factionId = ((Faction) o).getId();
|
||||
if (factionId == null) {
|
||||
return null;
|
||||
}
|
||||
if (factionId == null) {
|
||||
return null;
|
||||
}
|
||||
return Factions.FACTION_MONEY_ACCOUNT_ID_PREFIX + factionId;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
package net.knarcraft.factions;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.massivecraft.massivecore.MassivePlugin;
|
||||
import com.massivecraft.massivecore.command.type.RegistryType;
|
||||
import com.massivecraft.massivecore.store.migrator.MigratorUtil;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import net.knarcraft.factions.adapter.BoardAdapter;
|
||||
import net.knarcraft.factions.adapter.BoardMapAdapter;
|
||||
import net.knarcraft.factions.adapter.TerritoryAccessAdapter;
|
||||
@ -76,10 +80,6 @@ import net.knarcraft.factions.mixin.PowerMixin;
|
||||
import net.knarcraft.factions.task.TaskFlagPermCreate;
|
||||
import net.knarcraft.factions.task.TaskPlayerPowerUpdate;
|
||||
import net.knarcraft.factions.task.TaskTax;
|
||||
import com.massivecraft.massivecore.MassivePlugin;
|
||||
import com.massivecraft.massivecore.command.type.RegistryType;
|
||||
import com.massivecraft.massivecore.store.migrator.MigratorUtil;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.List;
|
||||
@ -95,7 +95,7 @@ public class Factions extends MassivePlugin {
|
||||
public final static String ID_SAFEZONE = "safezone";
|
||||
public final static String ID_WARZONE = "warzone";
|
||||
|
||||
public final static String NAME_NONE_DEFAULT = ChatColor.DARK_GREEN.toString() + "Wilderness";
|
||||
public final static String NAME_NONE_DEFAULT = ChatColor.DARK_GREEN + "Wilderness";
|
||||
public final static String NAME_SAFEZONE_DEFAULT = "SafeZone";
|
||||
public final static String NAME_WARZONE_DEFAULT = "WarZone";
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.knarcraft.factions;
|
||||
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.FactionColl;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.entity.MPlayerColl;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
@ -24,7 +24,7 @@ public class FactionsIndex {
|
||||
// INSTANCE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static FactionsIndex i = new FactionsIndex();
|
||||
private static final FactionsIndex i = new FactionsIndex();
|
||||
|
||||
public static FactionsIndex get() {
|
||||
return i;
|
||||
@ -35,7 +35,7 @@ public class FactionsIndex {
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final Map<MPlayer, Faction> mplayer2faction;
|
||||
private final Map<Faction, Set<MPlayer>> faction2mplayers;
|
||||
private final Map<Faction, Set<MPlayer>> faction2mPlayers;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
@ -43,7 +43,7 @@ public class FactionsIndex {
|
||||
|
||||
private FactionsIndex() {
|
||||
this.mplayer2faction = new WeakHashMap<>();
|
||||
this.faction2mplayers = new WeakHashMapCreativeImpl();
|
||||
this.faction2mPlayers = new WeakHashMapCreativeImpl();
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -51,12 +51,12 @@ public class FactionsIndex {
|
||||
// -------------------------------------------- //
|
||||
|
||||
private boolean isConnected(MPlayer mplayer, Faction faction) {
|
||||
if (mplayer == null) {
|
||||
throw new NullPointerException("mplayer");
|
||||
}
|
||||
if (faction == null) {
|
||||
throw new NullPointerException("faction");
|
||||
}
|
||||
if (mplayer == null) {
|
||||
throw new NullPointerException("mplayer");
|
||||
}
|
||||
if (faction == null) {
|
||||
throw new NullPointerException("faction");
|
||||
}
|
||||
|
||||
return mplayer.getFaction() == faction;
|
||||
}
|
||||
@ -70,7 +70,7 @@ public class FactionsIndex {
|
||||
}
|
||||
|
||||
public synchronized Set<MPlayer> getMPlayers(Faction faction) {
|
||||
return new MassiveSet<>(this.faction2mplayers.get(faction));
|
||||
return new MassiveSet<>(this.faction2mPlayers.get(faction));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -78,20 +78,20 @@ public class FactionsIndex {
|
||||
// -------------------------------------------- //
|
||||
|
||||
public synchronized void updateAll() {
|
||||
if (!MPlayerColl.get().isActive()) {
|
||||
throw new IllegalStateException("The MPlayerColl is not yet fully activated.");
|
||||
}
|
||||
if (!MPlayerColl.get().isActive()) {
|
||||
throw new IllegalStateException("The MPlayerColl is not yet fully activated.");
|
||||
}
|
||||
|
||||
MPlayerColl.get().getAll().forEach(this::update);
|
||||
}
|
||||
|
||||
public synchronized void update(MPlayer mplayer) {
|
||||
if (mplayer == null) {
|
||||
throw new NullPointerException("mplayer");
|
||||
}
|
||||
if (!FactionColl.get().isActive()) {
|
||||
throw new IllegalStateException("The FactionColl is not yet fully activated.");
|
||||
}
|
||||
if (mplayer == null) {
|
||||
throw new NullPointerException("mplayer");
|
||||
}
|
||||
if (!FactionColl.get().isActive()) {
|
||||
throw new IllegalStateException("The FactionColl is not yet fully activated.");
|
||||
}
|
||||
|
||||
// TODO: This is not optimal but here we remove a player from the index when
|
||||
// the mplayer object is deattached. Optimally it should be removed
|
||||
@ -101,7 +101,7 @@ public class FactionsIndex {
|
||||
if (!mplayer.attached()) {
|
||||
Faction factionIndexed = this.mplayer2faction.remove(mplayer);
|
||||
if (factionIndexed != null) {
|
||||
faction2mplayers.get(factionIndexed).remove(mplayer);
|
||||
faction2mPlayers.get(factionIndexed).remove(mplayer);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -110,19 +110,19 @@ public class FactionsIndex {
|
||||
Faction factionIndexed = this.getFaction(mplayer);
|
||||
|
||||
Set<Faction> factions = new MassiveSet<>();
|
||||
if (factionActual != null) {
|
||||
factions.add(factionActual);
|
||||
}
|
||||
if (factionIndexed != null) {
|
||||
factions.add(factionIndexed);
|
||||
}
|
||||
if (factionActual != null) {
|
||||
factions.add(factionActual);
|
||||
}
|
||||
if (factionIndexed != null) {
|
||||
factions.add(factionIndexed);
|
||||
}
|
||||
|
||||
for (Faction faction : factions) {
|
||||
boolean connected = this.isConnected(mplayer, faction);
|
||||
if (connected) {
|
||||
this.faction2mplayers.get(faction).add(mplayer);
|
||||
this.faction2mPlayers.get(faction).add(mplayer);
|
||||
} else {
|
||||
this.faction2mplayers.get(faction).remove(mplayer);
|
||||
this.faction2mPlayers.get(faction).remove(mplayer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,9 +130,9 @@ public class FactionsIndex {
|
||||
}
|
||||
|
||||
public synchronized void update(Faction faction) {
|
||||
if (faction == null) {
|
||||
throw new NullPointerException("faction");
|
||||
}
|
||||
if (faction == null) {
|
||||
throw new NullPointerException("faction");
|
||||
}
|
||||
|
||||
this.getMPlayers(faction).forEach(this::update);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.knarcraft.factions;
|
||||
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import com.massivecraft.massivecore.Colorized;
|
||||
import com.massivecraft.massivecore.Named;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.Collections;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.knarcraft.factions;
|
||||
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.util.RelationUtil;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -47,7 +47,7 @@ public class TerritoryAccess {
|
||||
// FIELDS: VERSION
|
||||
// -------------------------------------------- //
|
||||
|
||||
public int version = 1;
|
||||
public final int version = 1;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS: DELTA
|
||||
@ -116,12 +116,12 @@ public class TerritoryAccess {
|
||||
}
|
||||
|
||||
private TerritoryAccess(String hostFactionId, Boolean hostFactionAllowed, Collection<String> grantedIds, String chunkName) {
|
||||
if (hostFactionId == null) {
|
||||
throw new NullPointerException("hostFactionId");
|
||||
}
|
||||
if (grantedIds == null) {
|
||||
throw new NullPointerException("grantedIds");
|
||||
}
|
||||
if (hostFactionId == null) {
|
||||
throw new NullPointerException("hostFactionId");
|
||||
}
|
||||
if (grantedIds == null) {
|
||||
throw new NullPointerException("grantedIds");
|
||||
}
|
||||
this.hostFactionId = hostFactionId;
|
||||
|
||||
Set<String> grantedIdsInner = new MassiveSet<>();
|
||||
@ -141,19 +141,19 @@ public class TerritoryAccess {
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static TerritoryAccess valueOf(String hostFactionId, Boolean hostFactionAllowed, Collection<String> grantedIds, String chunkName) {
|
||||
if (hostFactionId == null) {
|
||||
throw new NullPointerException("hostFactionId");
|
||||
}
|
||||
if (grantedIds == null) {
|
||||
throw new NullPointerException("grantedIds");
|
||||
}
|
||||
if (hostFactionId == null) {
|
||||
throw new NullPointerException("hostFactionId");
|
||||
}
|
||||
if (grantedIds == null) {
|
||||
throw new NullPointerException("grantedIds");
|
||||
}
|
||||
return new TerritoryAccess(hostFactionId, hostFactionAllowed, grantedIds, chunkName);
|
||||
}
|
||||
|
||||
public static TerritoryAccess valueOf(String hostFactionId) {
|
||||
if (hostFactionId == null) {
|
||||
throw new NullPointerException("hostFactionId");
|
||||
}
|
||||
if (hostFactionId == null) {
|
||||
throw new NullPointerException("hostFactionId");
|
||||
}
|
||||
return valueOf(hostFactionId, null, Collections.emptySet(), null);
|
||||
}
|
||||
|
||||
@ -166,9 +166,9 @@ public class TerritoryAccess {
|
||||
}
|
||||
|
||||
public boolean isGranted(String permableId) {
|
||||
if (permableId.equals(this.hostFactionId)) {
|
||||
return this.isHostFactionAllowed();
|
||||
}
|
||||
if (permableId.equals(this.hostFactionId)) {
|
||||
return this.isHostFactionAllowed();
|
||||
}
|
||||
return this.getGrantedIds().contains(permableId);
|
||||
}
|
||||
|
||||
@ -183,26 +183,26 @@ public class TerritoryAccess {
|
||||
// -------------------------------------------- //
|
||||
|
||||
public AccessStatus getTerritoryAccess(MPlayer mplayer) {
|
||||
if (isGranted(mplayer.getId())) {
|
||||
return AccessStatus.ELEVATED;
|
||||
}
|
||||
if (isGranted(mplayer.getRank().getId())) {
|
||||
return AccessStatus.ELEVATED;
|
||||
}
|
||||
if (isGranted(mplayer.getId())) {
|
||||
return AccessStatus.ELEVATED;
|
||||
}
|
||||
if (isGranted(mplayer.getRank().getId())) {
|
||||
return AccessStatus.ELEVATED;
|
||||
}
|
||||
|
||||
if (this.getHostFactionId().equals(mplayer.getFaction().getId())) {
|
||||
if (this.isHostFactionAllowed()) {
|
||||
return AccessStatus.STANDARD;
|
||||
} else {
|
||||
return AccessStatus.DECREASED;
|
||||
}
|
||||
if (this.isHostFactionAllowed()) {
|
||||
return AccessStatus.STANDARD;
|
||||
} else {
|
||||
return AccessStatus.DECREASED;
|
||||
}
|
||||
}
|
||||
if (isGranted(mplayer.getFaction().getId())) {
|
||||
return AccessStatus.ELEVATED;
|
||||
}
|
||||
if (isGranted(RelationUtil.getRelationOfThatToMe(mplayer, this.getHostFaction()).toString())) {
|
||||
return AccessStatus.ELEVATED;
|
||||
}
|
||||
if (isGranted(mplayer.getFaction().getId())) {
|
||||
return AccessStatus.ELEVATED;
|
||||
}
|
||||
if (isGranted(RelationUtil.getRelationOfThatToMe(mplayer, this.getHostFaction()).toString())) {
|
||||
return AccessStatus.ELEVATED;
|
||||
}
|
||||
|
||||
return AccessStatus.STANDARD;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class BoardAdapter implements JsonDeserializer<Board>, JsonSerializer<Boa
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static BoardAdapter i = new BoardAdapter();
|
||||
private static final BoardAdapter i = new BoardAdapter();
|
||||
|
||||
public static BoardAdapter get() {
|
||||
return i;
|
||||
@ -25,7 +25,6 @@ public class BoardAdapter implements JsonDeserializer<Board>, JsonSerializer<Boa
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Board deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
return new Board(context.deserialize(json, Board.MAP_TYPE));
|
||||
|
@ -7,8 +7,8 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
@ -20,7 +20,7 @@ public class BoardMapAdapter implements JsonDeserializer<Map<PS, TerritoryAccess
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static BoardMapAdapter i = new BoardMapAdapter();
|
||||
private static final BoardMapAdapter i = new BoardMapAdapter();
|
||||
|
||||
public static BoardMapAdapter get() {
|
||||
return i;
|
||||
@ -37,9 +37,9 @@ public class BoardMapAdapter implements JsonDeserializer<Map<PS, TerritoryAccess
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
|
||||
for (Entry<String, JsonElement> entry : jsonObject.entrySet()) {
|
||||
String[] ChunkCoordParts = entry.getKey().split("[,\\s]+");
|
||||
int chunkX = Integer.parseInt(ChunkCoordParts[0]);
|
||||
int chunkZ = Integer.parseInt(ChunkCoordParts[1]);
|
||||
String[] chunkCoordinateParts = entry.getKey().split("[,\\s]+");
|
||||
int chunkX = Integer.parseInt(chunkCoordinateParts[0]);
|
||||
int chunkZ = Integer.parseInt(chunkCoordinateParts[1]);
|
||||
PS chunk = PS.valueOf(chunkX, chunkZ);
|
||||
|
||||
TerritoryAccess territoryAccess = context.deserialize(entry.getValue(), TerritoryAccess.class);
|
||||
|
@ -10,8 +10,8 @@ import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
import com.massivecraft.massivecore.store.migrator.MigratorUtil;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Collections;
|
||||
@ -34,7 +34,7 @@ public class TerritoryAccessAdapter implements JsonDeserializer<TerritoryAccess>
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static TerritoryAccessAdapter i = new TerritoryAccessAdapter();
|
||||
private static final TerritoryAccessAdapter i = new TerritoryAccessAdapter();
|
||||
|
||||
public static TerritoryAccessAdapter get() {
|
||||
return i;
|
||||
@ -68,28 +68,28 @@ public class TerritoryAccessAdapter implements JsonDeserializer<TerritoryAccess>
|
||||
hostFactionId = element.getAsString();
|
||||
|
||||
element = obj.get(HOST_FACTION_ALLOWED);
|
||||
if (element != null) {
|
||||
hostFactionAllowed = element.getAsBoolean();
|
||||
}
|
||||
if (element != null) {
|
||||
hostFactionAllowed = element.getAsBoolean();
|
||||
}
|
||||
|
||||
element = obj.get(GRANTED_IDS);
|
||||
if (element != null) {
|
||||
grantedIds = context.deserialize(element, SET_OF_STRING_TYPE);
|
||||
}
|
||||
if (element != null) {
|
||||
grantedIds = context.deserialize(element, SET_OF_STRING_TYPE);
|
||||
}
|
||||
|
||||
element = obj.get(CHUNK_NAME);
|
||||
if (element != null) {
|
||||
chunkName = element.getAsString();
|
||||
}
|
||||
if (element != null) {
|
||||
chunkName = element.getAsString();
|
||||
}
|
||||
|
||||
return TerritoryAccess.valueOf(hostFactionId, hostFactionAllowed, grantedIds, chunkName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(TerritoryAccess src, Type typeOfSrc, JsonSerializationContext context) {
|
||||
if (src == null) {
|
||||
return null;
|
||||
}
|
||||
if (src == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// isDefault <=> simple hostFactionId string
|
||||
if (src.isDefault()) {
|
||||
|
@ -9,10 +9,10 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* The ChatFormater is a system offered by factions for tag parsing.
|
||||
* The ChatFormatter is a system offered by factions for tag parsing.
|
||||
* <p>
|
||||
* Note that every tag and modifier id must be lowercase.
|
||||
* A tag with id "derp" is allowed but not with id "Derp". For that reason the tag {sender} will work but {Sender} wont.
|
||||
* A tag with id "derp" is allowed but not with id "Derp". For that reason the tag {sender} will work but {Sender} won't.
|
||||
*/
|
||||
public class ChatFormatter {
|
||||
// -------------------------------------------- //
|
||||
@ -33,23 +33,23 @@ public class ChatFormatter {
|
||||
// FORMAT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static String format(String msg, CommandSender sender, CommandSender recipient) {
|
||||
public static String format(String message, CommandSender sender, CommandSender recipient) {
|
||||
// We build the return value in this string buffer
|
||||
StringBuffer ret = new StringBuffer();
|
||||
StringBuilder returnValue = new StringBuilder();
|
||||
|
||||
// A matcher to match all the tags in the msg
|
||||
Matcher matcher = pattern.matcher(msg);
|
||||
Matcher matcher = pattern.matcher(message);
|
||||
|
||||
// For each tag we find
|
||||
while (matcher.find()) {
|
||||
// The fullmatch is something like "{sender|lp|rp}"
|
||||
String fullmatch = matcher.group(0);
|
||||
// The fullMatch is something like "{sender|lp|rp}"
|
||||
String fullMatch = matcher.group(0);
|
||||
|
||||
// The submatch is something like "sender|lp|rp"
|
||||
String submatch = matcher.group(1);
|
||||
// The subMatch is something like "sender|lp|rp"
|
||||
String subMatch = matcher.group(1);
|
||||
|
||||
// The parts are something like ["sender", "lp", "rp"]
|
||||
String[] parts = submatch.split(ESC_SEPARATOR);
|
||||
String[] parts = subMatch.split(ESC_SEPARATOR);
|
||||
|
||||
// The modifier ids are something like ["lp", "rp"] and tagId something like "sender"
|
||||
List<String> modifierIds = new ArrayList<>(Arrays.asList(parts));
|
||||
@ -61,23 +61,23 @@ public class ChatFormatter {
|
||||
String replacement;
|
||||
if (tag == null) {
|
||||
// No change if tag wasn't found
|
||||
replacement = fullmatch;
|
||||
replacement = fullMatch;
|
||||
} else {
|
||||
replacement = compute(tag, modifierIds, sender, recipient);
|
||||
if (replacement == null) {
|
||||
// If a tag or modifier returns null it's the same as opting out.
|
||||
replacement = fullmatch;
|
||||
replacement = fullMatch;
|
||||
}
|
||||
}
|
||||
|
||||
matcher.appendReplacement(ret, replacement);
|
||||
matcher.appendReplacement(returnValue, replacement);
|
||||
}
|
||||
|
||||
// Append the rest
|
||||
matcher.appendTail(ret);
|
||||
matcher.appendTail(returnValue);
|
||||
|
||||
// And finally we return the string value of the buffer we built
|
||||
return ret.toString();
|
||||
return returnValue.toString();
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -12,7 +12,7 @@ public class ChatModifierLc extends ChatModifier {
|
||||
super("lc");
|
||||
}
|
||||
|
||||
private static ChatModifierLc i = new ChatModifierLc();
|
||||
private static final ChatModifierLc i = new ChatModifierLc();
|
||||
|
||||
public static ChatModifierLc get() {
|
||||
return i;
|
||||
|
@ -13,7 +13,7 @@ public class ChatModifierLp extends ChatModifier {
|
||||
super("lp");
|
||||
}
|
||||
|
||||
private static ChatModifierLp i = new ChatModifierLp();
|
||||
private static final ChatModifierLp i = new ChatModifierLp();
|
||||
|
||||
public static ChatModifierLp get() {
|
||||
return i;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.knarcraft.factions.chat.modifier;
|
||||
|
||||
import net.knarcraft.factions.chat.ChatModifier;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.chat.ChatModifier;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ChatModifierParse extends ChatModifier {
|
||||
@ -13,7 +13,7 @@ public class ChatModifierParse extends ChatModifier {
|
||||
super("parse");
|
||||
}
|
||||
|
||||
private static ChatModifierParse i = new ChatModifierParse();
|
||||
private static final ChatModifierParse i = new ChatModifierParse();
|
||||
|
||||
public static ChatModifierParse get() {
|
||||
return i;
|
||||
|
@ -12,7 +12,7 @@ public class ChatModifierRp extends ChatModifier {
|
||||
super("rp");
|
||||
}
|
||||
|
||||
private static ChatModifierRp i = new ChatModifierRp();
|
||||
private static final ChatModifierRp i = new ChatModifierRp();
|
||||
|
||||
public static ChatModifierRp get() {
|
||||
return i;
|
||||
@ -24,9 +24,9 @@ public class ChatModifierRp extends ChatModifier {
|
||||
|
||||
@Override
|
||||
public String getModified(String subject, CommandSender sender, CommandSender recipient) {
|
||||
if (subject.equals("")) {
|
||||
return subject;
|
||||
}
|
||||
if (subject.equals("")) {
|
||||
return subject;
|
||||
}
|
||||
return subject + " ";
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ public class ChatModifierUc extends ChatModifier {
|
||||
super("uc");
|
||||
}
|
||||
|
||||
private static ChatModifierUc i = new ChatModifierUc();
|
||||
private static final ChatModifierUc i = new ChatModifierUc();
|
||||
|
||||
public static ChatModifierUc get() {
|
||||
return i;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.knarcraft.factions.chat.modifier;
|
||||
|
||||
import net.knarcraft.factions.chat.ChatModifier;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.chat.ChatModifier;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ChatModifierUcf extends ChatModifier {
|
||||
@ -13,7 +13,7 @@ public class ChatModifierUcf extends ChatModifier {
|
||||
super("ucf");
|
||||
}
|
||||
|
||||
private static ChatModifierUcf i = new ChatModifierUcf();
|
||||
private static final ChatModifierUcf i = new ChatModifierUcf();
|
||||
|
||||
public static ChatModifierUcf get() {
|
||||
return i;
|
||||
|
@ -14,7 +14,7 @@ public class ChatTagName extends ChatTag {
|
||||
super("factions_name");
|
||||
}
|
||||
|
||||
private static ChatTagName i = new ChatTagName();
|
||||
private static final ChatTagName i = new ChatTagName();
|
||||
|
||||
public static ChatTagName get() {
|
||||
return i;
|
||||
@ -27,13 +27,13 @@ public class ChatTagName extends ChatTag {
|
||||
@Override
|
||||
public String getReplacement(CommandSender sender, CommandSender recipient) {
|
||||
// Get entities
|
||||
MPlayer usender = MPlayer.get(sender);
|
||||
MPlayer uSender = MPlayer.get(sender);
|
||||
|
||||
// No "force"
|
||||
Faction faction = usender.getFaction();
|
||||
if (faction.isNone()) {
|
||||
return "";
|
||||
}
|
||||
Faction faction = uSender.getFaction();
|
||||
if (faction.isNone()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return faction.getName();
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class ChatTagNameforce extends ChatTag {
|
||||
super("factions_nameforce");
|
||||
}
|
||||
|
||||
private static ChatTagNameforce i = new ChatTagNameforce();
|
||||
private static final ChatTagNameforce i = new ChatTagNameforce();
|
||||
|
||||
public static ChatTagNameforce get() {
|
||||
return i;
|
||||
|
@ -13,7 +13,7 @@ public class ChatTagRelcolor extends ChatTag {
|
||||
super("factions_relcolor");
|
||||
}
|
||||
|
||||
private static ChatTagRelcolor i = new ChatTagRelcolor();
|
||||
private static final ChatTagRelcolor i = new ChatTagRelcolor();
|
||||
|
||||
public static ChatTagRelcolor get() {
|
||||
return i;
|
||||
@ -26,9 +26,9 @@ public class ChatTagRelcolor extends ChatTag {
|
||||
@Override
|
||||
public String getReplacement(CommandSender sender, CommandSender recipient) {
|
||||
// Opt out if no recipient
|
||||
if (recipient == null) {
|
||||
return null;
|
||||
}
|
||||
if (recipient == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get entities
|
||||
MPlayer usender = MPlayer.get(sender);
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.knarcraft.factions.chat.tag;
|
||||
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.chat.ChatTag;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ChatTagRole extends ChatTag {
|
||||
@ -14,7 +14,7 @@ public class ChatTagRole extends ChatTag {
|
||||
super("factions_role");
|
||||
}
|
||||
|
||||
private static ChatTagRole i = new ChatTagRole();
|
||||
private static final ChatTagRole i = new ChatTagRole();
|
||||
|
||||
public static ChatTagRole get() {
|
||||
return i;
|
||||
|
@ -14,7 +14,7 @@ public class ChatTagRoleprefix extends ChatTag {
|
||||
super("factions_roleprefix");
|
||||
}
|
||||
|
||||
private static ChatTagRoleprefix i = new ChatTagRoleprefix();
|
||||
private static final ChatTagRoleprefix i = new ChatTagRoleprefix();
|
||||
|
||||
public static ChatTagRoleprefix get() {
|
||||
return i;
|
||||
|
@ -13,7 +13,7 @@ public class ChatTagRoleprefixforce extends ChatTag {
|
||||
super("factions_roleprefixforce");
|
||||
}
|
||||
|
||||
private static ChatTagRoleprefixforce i = new ChatTagRoleprefixforce();
|
||||
private static final ChatTagRoleprefixforce i = new ChatTagRoleprefixforce();
|
||||
|
||||
public static ChatTagRoleprefixforce get() {
|
||||
return i;
|
||||
|
@ -13,7 +13,7 @@ public class ChatTagTitle extends ChatTag {
|
||||
super("factions_title");
|
||||
}
|
||||
|
||||
private static ChatTagTitle i = new ChatTagTitle();
|
||||
private static final ChatTagTitle i = new ChatTagTitle();
|
||||
|
||||
public static ChatTagTitle get() {
|
||||
return i;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.command.MassiveCommandDeprecated;
|
||||
import com.massivecraft.massivecore.command.MassiveCommandVersion;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -12,7 +12,7 @@ public class CmdFactions extends FactionsCommand {
|
||||
// INSTANCE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static CmdFactions i = new CmdFactions();
|
||||
private static final CmdFactions i = new CmdFactions();
|
||||
|
||||
public static CmdFactions get() {
|
||||
return i;
|
||||
@ -28,21 +28,21 @@ public class CmdFactions extends FactionsCommand {
|
||||
public CmdFactionsPlayer cmdFactionsPlayer = new CmdFactionsPlayer();
|
||||
public CmdFactionsStatus cmdFactionsStatus = new CmdFactionsStatus();
|
||||
public CmdFactionsJoin cmdFactionsJoin = new CmdFactionsJoin();
|
||||
public CmdFactionsLeave cmdFactionsLeave = new CmdFactionsLeave();
|
||||
public CmdFactionsWarp cmdFactionsWarp = new CmdFactionsWarp();
|
||||
public final CmdFactionsLeave cmdFactionsLeave = new CmdFactionsLeave();
|
||||
public final CmdFactionsWarp cmdFactionsWarp = new CmdFactionsWarp();
|
||||
public CmdFactionsHome cmdFactionsHome = new CmdFactionsHome();
|
||||
public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome();
|
||||
public CmdFactionsUnsethome cmdFactionsUnsethome = new CmdFactionsUnsethome();
|
||||
public CmdFactionsVote cmdFactionsVote = new CmdFactionsVote();
|
||||
public final CmdFactionsVote cmdFactionsVote = new CmdFactionsVote();
|
||||
public CmdFactionsMap cmdFactionsMap = new CmdFactionsMap();
|
||||
public CmdFactionsCreate cmdFactionsCreate = new CmdFactionsCreate();
|
||||
public CmdFactionsName cmdFactionsName = new CmdFactionsName();
|
||||
public CmdFactionsDescription cmdFactionsDescription = new CmdFactionsDescription();
|
||||
public final CmdFactionsCreate cmdFactionsCreate = new CmdFactionsCreate();
|
||||
public final CmdFactionsName cmdFactionsName = new CmdFactionsName();
|
||||
public final CmdFactionsDescription cmdFactionsDescription = new CmdFactionsDescription();
|
||||
public CmdFactionsMotd cmdFactionsMotd = new CmdFactionsMotd();
|
||||
public CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite();
|
||||
public CmdFactionsKick cmdFactionsKick = new CmdFactionsKick();
|
||||
public CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle();
|
||||
public CmdFactionsRank cmdFactionsRank = new CmdFactionsRank();
|
||||
public final CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite();
|
||||
public final CmdFactionsKick cmdFactionsKick = new CmdFactionsKick();
|
||||
public final CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle();
|
||||
public final CmdFactionsRank cmdFactionsRank = new CmdFactionsRank();
|
||||
public CmdFactionsMoney cmdFactionsMoney = new CmdFactionsMoney();
|
||||
public CmdFactionsTop cmdFactionsTop = new CmdFactionsTop();
|
||||
public CmdFactionsSeeChunk cmdFactionsSeeChunk = new CmdFactionsSeeChunk();
|
||||
@ -52,17 +52,17 @@ public class CmdFactions extends FactionsCommand {
|
||||
public CmdFactionsUnclaim cmdFactionsUnclaim = new CmdFactionsUnclaim();
|
||||
public CmdFactionsAccess cmdFactionsAccess = new CmdFactionsAccess();
|
||||
public CmdFactionsChunkname cmdFactionsChunkname = new CmdFactionsChunkname();
|
||||
public CmdFactionsRelation cmdFactionsRelation = new CmdFactionsRelation();
|
||||
public final CmdFactionsRelation cmdFactionsRelation = new CmdFactionsRelation();
|
||||
public CmdFactionsRelationOld cmdFactionsRelationOldAlly = new CmdFactionsRelationOld("ally");
|
||||
public CmdFactionsRelationOld cmdFactionsRelationOldTruce = new CmdFactionsRelationOld("truce");
|
||||
public CmdFactionsRelationOld cmdFactionsRelationOldNeutral = new CmdFactionsRelationOld("neutral");
|
||||
public CmdFactionsRelationOld cmdFactionsRelationOldEnemy = new CmdFactionsRelationOld("enemy");
|
||||
public CmdFactionsTax cmdFactionsTax = new CmdFactionsTax();
|
||||
public CmdFactionsPerm cmdFactionsPerm = new CmdFactionsPerm();
|
||||
public CmdFactionsFlag cmdFactionsFlag = new CmdFactionsFlag();
|
||||
public final CmdFactionsPerm cmdFactionsPerm = new CmdFactionsPerm();
|
||||
public final CmdFactionsFlag cmdFactionsFlag = new CmdFactionsFlag();
|
||||
public CmdFactionsFly cmdFactionsFly = new CmdFactionsFly();
|
||||
public CmdFactionsUnstuck cmdFactionsUnstuck = new CmdFactionsUnstuck();
|
||||
public CmdFactionsOverride cmdFactionsOverride = new CmdFactionsOverride();
|
||||
public final CmdFactionsOverride cmdFactionsOverride = new CmdFactionsOverride();
|
||||
public CmdFactionsDisband cmdFactionsDisband = new CmdFactionsDisband();
|
||||
public CmdFactionsPowerboost cmdFactionsPowerBoost = new CmdFactionsPowerboost();
|
||||
public CmdFactionsSetpower cmdFactionsSetpower = new CmdFactionsSetpower();
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.util.AsciiMap;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPermable;
|
||||
import net.knarcraft.factions.entity.Board;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveMap;
|
||||
import com.massivecraft.massivecore.mixin.MixinWorld;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPermable;
|
||||
import net.knarcraft.factions.entity.Board;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -44,9 +44,9 @@ public class CmdFactionsAccessInspect extends FactionsCommand {
|
||||
|
||||
// Check if they have access perms, unless they are checking for their own access
|
||||
if (mpermable != msender && mpermable != msenderFaction && mpermable != msender.getRank()) {
|
||||
if (!MPerm.getPermAccess().has(msender, faction, true)) {
|
||||
return;
|
||||
}
|
||||
if (!MPerm.getPermAccess().has(msender, faction, true)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Turn into id->chunks
|
||||
@ -59,9 +59,9 @@ public class CmdFactionsAccessInspect extends FactionsCommand {
|
||||
.filter(e -> e.getValue().isGranted(mpermable))
|
||||
.map(Entry::getKey)
|
||||
.collect(Collectors.toSet());
|
||||
if (!chunks.isEmpty()) {
|
||||
world2Chunks.put(worldId, chunks);
|
||||
}
|
||||
if (!chunks.isEmpty()) {
|
||||
world2Chunks.put(worldId, chunks);
|
||||
}
|
||||
}
|
||||
|
||||
if (world2Chunks.isEmpty()) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.ChunkUtil;
|
||||
import net.knarcraft.factions.Perm;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -1,14 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.ChunkUtil;
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
@ -36,7 +35,7 @@ public class CmdFactionsAccessSetFill extends CmdFactionsAccessSetXSimple {
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public Set<PS> getChunks() throws MassiveException {
|
||||
public Set<PS> getChunks() {
|
||||
// Common Startup
|
||||
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import net.knarcraft.factions.Perm;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.ChunkUtil;
|
||||
import net.knarcraft.factions.Perm;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeMPermable;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPermable;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
|
||||
import java.util.Set;
|
||||
@ -52,9 +52,9 @@ public abstract class CmdFactionsAccessSetX extends CmdFactionsAccessAbstract {
|
||||
final MPerm.MPermable mpermable = this.getMPermable(hostFaction);
|
||||
|
||||
final Set<PS> chunks = this.getChunks();
|
||||
if (chunks == null) {
|
||||
throw new NullPointerException("chunks");
|
||||
}
|
||||
if (chunks == null) {
|
||||
throw new NullPointerException("chunks");
|
||||
}
|
||||
|
||||
// Apply / Inform
|
||||
setAccess(chunks, mpermable, this.isGranting());
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeMPermable;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPermable;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
|
||||
|
||||
public abstract class CmdFactionsAccessSetXRadius extends CmdFactionsAccessSetX {
|
||||
|
@ -1,9 +1,5 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.util.AsciiMap;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.command.type.TypeNullable;
|
||||
@ -11,6 +7,10 @@ import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.util.AsciiMap;
|
||||
|
||||
public class CmdFactionsChunkname extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -1,5 +1,9 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.store.EntityInternalMap;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Rel;
|
||||
import net.knarcraft.factions.TerritoryAccess;
|
||||
import net.knarcraft.factions.entity.Board;
|
||||
@ -10,11 +14,6 @@ import net.knarcraft.factions.entity.Invitation;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.entity.MPlayerColl;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.store.EntityInternalMap;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
@ -26,7 +25,7 @@ public class CmdFactionsClean extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveException {
|
||||
public void perform() {
|
||||
Object message;
|
||||
int count;
|
||||
|
||||
@ -54,9 +53,9 @@ public class CmdFactionsClean extends FactionsCommand {
|
||||
int ret = 0;
|
||||
|
||||
for (MPlayer mplayer : MPlayerColl.get().getAll()) {
|
||||
if (!mplayer.isFactionOrphan()) {
|
||||
continue;
|
||||
}
|
||||
if (!mplayer.isFactionOrphan()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mplayer.resetFactionData();
|
||||
ret += 1;
|
||||
@ -70,9 +69,9 @@ public class CmdFactionsClean extends FactionsCommand {
|
||||
|
||||
for (Faction faction : FactionColl.get().getAll()) {
|
||||
EntityInternalMap<Invitation> invitations = faction.getInvitations();
|
||||
if (invitations.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (invitations.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ret += invitations.size();
|
||||
Set<String> invitationIds = new MassiveSet<>(invitations.keySet());
|
||||
@ -93,9 +92,9 @@ public class CmdFactionsClean extends FactionsCommand {
|
||||
for (Iterator<Entry<String, Rel>> iterator = faction.getRelationWishes().entrySet().iterator(); iterator.hasNext(); ) {
|
||||
Entry<String, Rel> entry = iterator.next();
|
||||
String factionId = entry.getKey();
|
||||
if (FactionColl.get().containsId(factionId)) {
|
||||
continue;
|
||||
}
|
||||
if (FactionColl.get().containsId(factionId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
iterator.remove();
|
||||
ret += 1;
|
||||
@ -115,9 +114,9 @@ public class CmdFactionsClean extends FactionsCommand {
|
||||
TerritoryAccess territoryAccess = entry.getValue();
|
||||
String factionId = territoryAccess.getHostFactionId();
|
||||
|
||||
if (FactionColl.get().containsId(factionId)) {
|
||||
continue;
|
||||
}
|
||||
if (FactionColl.get().containsId(factionId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
board.removeAt(ps);
|
||||
ret += 1;
|
||||
@ -137,9 +136,9 @@ public class CmdFactionsClean extends FactionsCommand {
|
||||
boolean changed = false;
|
||||
|
||||
for (String grantedIds : territoryAccess.getGrantedIds()) {
|
||||
if (MPerm.idToMPermableOptional(grantedIds).isPresent()) {
|
||||
continue;
|
||||
}
|
||||
if (MPerm.idToMPermableOptional(grantedIds).isPresent()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
territoryAccess = territoryAccess.withGrantedId(grantedIds, false);
|
||||
ret += 1;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.command.editor.CommandEditSingleton;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
|
||||
public class CmdFactionsConfig extends CommandEditSingleton<MConf> {
|
||||
// -------------------------------------------- //
|
||||
|
@ -1,5 +1,8 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.store.MStore;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.req.ReqHasntFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeFactionNameStrict;
|
||||
@ -8,9 +11,6 @@ import net.knarcraft.factions.entity.FactionColl;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.event.EventFactionsCreate;
|
||||
import net.knarcraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.store.MStore;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdFactionsCreate extends FactionsCommand {
|
||||
@ -44,9 +44,9 @@ public class CmdFactionsCreate extends FactionsCommand {
|
||||
// Event
|
||||
EventFactionsCreate createEvent = new EventFactionsCreate(sender, factionId, newName);
|
||||
createEvent.run();
|
||||
if (createEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (createEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply
|
||||
Faction faction = FactionColl.get().create(factionId);
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
import com.massivecraft.massivecore.mixin.MixinDisplayName;
|
||||
import net.knarcraft.factions.cmd.req.ReqHasFaction;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.event.EventFactionsDescriptionChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
import com.massivecraft.massivecore.mixin.MixinDisplayName;
|
||||
|
||||
public class CmdFactionsDescription extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -1,5 +1,10 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeStringConfirmation;
|
||||
import com.massivecraft.massivecore.util.ConfirmationUtil;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
@ -10,11 +15,6 @@ import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.event.EventFactionsDisband;
|
||||
import net.knarcraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeStringConfirmation;
|
||||
import com.massivecraft.massivecore.util.ConfirmationUtil;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdFactionsDisband extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
@ -37,14 +37,14 @@ public class CmdFactionsDisband extends FactionsCommand {
|
||||
Faction faction = this.readArg();
|
||||
String confirmationString = this.readArg(null);
|
||||
|
||||
if (MConf.get().requireConfirmationForFactionDisbanding) {
|
||||
ConfirmationUtil.tryConfirm(this);
|
||||
}
|
||||
if (MConf.get().requireConfirmationForFactionDisbanding) {
|
||||
ConfirmationUtil.tryConfirm(this);
|
||||
}
|
||||
|
||||
// MPerm
|
||||
if (!MPerm.getPermDisband().has(msender, faction, true)) {
|
||||
return;
|
||||
}
|
||||
if (!MPerm.getPermDisband().has(msender, faction, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Verify
|
||||
if (faction.getFlag(MFlag.getFlagPermanent())) {
|
||||
@ -54,9 +54,9 @@ public class CmdFactionsDisband extends FactionsCommand {
|
||||
// Event
|
||||
EventFactionsDisband event = new EventFactionsDisband(me, faction);
|
||||
event.run();
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Merged Apply and Inform
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.entity.MFlag;
|
||||
import net.knarcraft.factions.entity.MFlagColl;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -22,7 +21,7 @@ public class CmdFactionsDocumentationFlags extends FactionsCommandDocumentation
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveException {
|
||||
public void perform() {
|
||||
msgDoc("Flags are a way to give certain factions certain attributes " +
|
||||
" such as disabling pvp or enabling friendly fire.");
|
||||
msgDoc("To see all the flags type:");
|
||||
|
@ -1,7 +1,5 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class CmdFactionsDocumentationPerms extends FactionsCommandDocumentation {
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
@ -16,7 +14,7 @@ public class CmdFactionsDocumentationPerms extends FactionsCommandDocumentation
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveException {
|
||||
public void perform() {
|
||||
msgDoc("Permissions decide who can do what in your faction. " +
|
||||
"Permissions can be given to a rank, a player, a relation, " +
|
||||
"everyone in another faction or everyone with a specific rank in another faction.");
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class CmdFactionsDocumentationPower extends FactionsCommandDocumentation {
|
||||
// -------------------------------------------- //
|
||||
@ -17,7 +16,7 @@ public class CmdFactionsDocumentationPower extends FactionsCommandDocumentation
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveException {
|
||||
public void perform() {
|
||||
msgDoc("All players have an amount of power ranging from <h>%.2f <i>to <h>%.2f<i>.", MConf.get().powerMin, MConf.get().powerMax);
|
||||
msgDoc("The power of a faction is equal to the combined power of all it's members.");
|
||||
msgDoc("Your power is <h>%.2f<i>", msender.getPower());
|
||||
|
@ -1,9 +1,8 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.Comparator;
|
||||
@ -24,7 +23,7 @@ public class CmdFactionsDocumentationRanks extends FactionsCommandDocumentation
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveException {
|
||||
public void perform() {
|
||||
msgDoc("Ranks divide the faction into groups.");
|
||||
|
||||
List<Rank> ranks = msenderFaction.getRanks().getAll(Comparator.comparingInt(Rank::getPriority).reversed());
|
||||
|
@ -1,12 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.req.ReqTaxEnabled;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.TimeDiffUtil;
|
||||
import com.massivecraft.massivecore.util.TimeUnit;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.req.ReqTaxEnabled;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@ -24,7 +23,7 @@ public class CmdFactionsDocumentationTax extends FactionsCommandDocumentation {
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveException {
|
||||
public void perform() {
|
||||
LinkedHashMap<TimeUnit, Long> timeUnitcounts = TimeDiffUtil.limit(TimeDiffUtil.unitcounts(MConf.get().taxTaskPeriodMillis, TimeUnit.getAll()), 3);
|
||||
String periodString = TimeDiffUtil.formatedVerboose(timeUnitcounts);
|
||||
|
||||
|
@ -3,7 +3,6 @@ package net.knarcraft.factions.cmd;
|
||||
import net.knarcraft.factions.cmd.req.ReqFactionWarpsEnabled;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ -21,7 +20,7 @@ public class CmdFactionsDocumentationWarps extends FactionsCommandDocumentation
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveException {
|
||||
public void perform() {
|
||||
msgDoc("A faction can have warps which allows it's members to easily go to important places within the faction.");
|
||||
|
||||
if (MConf.get().warpsMax < 0) {
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.event.EventFactionsFactionShowAsync;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.PriorityLines;
|
||||
import com.massivecraft.massivecore.mixin.MixinMessage;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.event.EventFactionsFactionShowAsync;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
@ -5,8 +5,8 @@ public class CmdFactionsFlag extends FactionsCommand {
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdFactionsFlagList cmdFactionsFlagList = new CmdFactionsFlagList();
|
||||
public final CmdFactionsFlagList cmdFactionsFlagList = new CmdFactionsFlagList();
|
||||
public CmdFactionsFlagShow cmdFactionsFlagShow = new CmdFactionsFlagShow();
|
||||
public CmdFactionsFlagSet cmdFactionsFlagSet = new CmdFactionsFlagSet();
|
||||
public final CmdFactionsFlagSet cmdFactionsFlagSet = new CmdFactionsFlagSet();
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.entity.MFlag;
|
||||
import net.knarcraft.factions.entity.MFlagColl;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.Parameter;
|
||||
import com.massivecraft.massivecore.pager.Pager;
|
||||
import com.massivecraft.massivecore.pager.Stringifier;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.entity.MFlag;
|
||||
import net.knarcraft.factions.entity.MFlagColl;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeMFlag;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MFlag;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.event.EventFactionsFlagChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
|
||||
|
||||
public class CmdFactionsFlagSet extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MFlag;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.command.Parameter;
|
||||
import com.massivecraft.massivecore.pager.Pager;
|
||||
import com.massivecraft.massivecore.pager.Stringifier;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MFlag;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.engine.EngineFly;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.MassiveCommandToggle;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.engine.EngineMassiveCorePlayerUpdate;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import net.knarcraft.factions.engine.EngineFly;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CmdFactionsFly extends MassiveCommandToggle {
|
||||
@ -14,7 +14,7 @@ public class CmdFactionsFly extends MassiveCommandToggle {
|
||||
// INSTANCE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static CmdFactionsFly i = new CmdFactionsFly();
|
||||
private static final CmdFactionsFly i = new CmdFactionsFly();
|
||||
|
||||
public static CmdFactionsFly get() {
|
||||
return i;
|
||||
@ -38,21 +38,21 @@ public class CmdFactionsFly extends MassiveCommandToggle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getValue() throws MassiveException {
|
||||
public boolean getValue() {
|
||||
return MPlayer.get(sender).isFlying();
|
||||
}
|
||||
|
||||
public void setValue(boolean value) throws MassiveException {
|
||||
MPlayer mplayer = MPlayer.get(sender);
|
||||
Player player = me;
|
||||
if (player == null) {
|
||||
throw new MassiveException().addMsg("<b>Could not find player.");
|
||||
}
|
||||
if (player == null) {
|
||||
throw new MassiveException().addMsg("<b>Could not find player.");
|
||||
}
|
||||
|
||||
PS ps = PS.valueOf(player);
|
||||
if (value) {
|
||||
EngineFly.canFlyInTerritoryOrThrow(mplayer, ps);
|
||||
}
|
||||
if (value) {
|
||||
EngineFly.canFlyInTerritoryOrThrow(mplayer, ps);
|
||||
}
|
||||
|
||||
mplayer.setFlying(value);
|
||||
EngineMassiveCorePlayerUpdate.update(player, false);
|
||||
|
@ -1,11 +1,10 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.Visibility;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -31,7 +30,7 @@ public class CmdFactionsHome extends FactionsCommandWarp {
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform() throws MassiveException {
|
||||
public void perform() {
|
||||
List<String> args = MUtil.list(MConf.get().warpsHomeName, this.argAt(0));
|
||||
CmdFactions.get().cmdFactionsWarp.cmdFactionsWarpGo.execute(me, args);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class CmdFactionsInvite extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdFactionsInviteList cmdFactionsInviteList = new CmdFactionsInviteList();
|
||||
public CmdFactionsInviteAdd cmdFactionsInviteAdd = new CmdFactionsInviteAdd();
|
||||
public CmdFactionsInviteRemove cmdFactionsInviteRemove = new CmdFactionsInviteRemove();
|
||||
public final CmdFactionsInviteAdd cmdFactionsInviteAdd = new CmdFactionsInviteAdd();
|
||||
public final CmdFactionsInviteRemove cmdFactionsInviteRemove = new CmdFactionsInviteRemove();
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
import net.knarcraft.factions.entity.Invitation;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.event.EventFactionsInvitedChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.container.TypeSet;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
import net.knarcraft.factions.entity.Invitation;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.event.EventFactionsInvitedChange;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -37,9 +37,9 @@ public class CmdFactionsInviteAdd extends FactionsCommand {
|
||||
long creationMillis = System.currentTimeMillis();
|
||||
|
||||
// MPerm
|
||||
if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
|
||||
return;
|
||||
}
|
||||
if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (MPlayer mplayer : mplayers) {
|
||||
// Already member?
|
||||
@ -55,9 +55,9 @@ public class CmdFactionsInviteAdd extends FactionsCommand {
|
||||
// Event
|
||||
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, msenderFaction, isInvited);
|
||||
event.run();
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
isInvited = event.isNewInvited();
|
||||
|
||||
// Inform
|
||||
|
@ -1,10 +1,5 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.Invitation;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.command.Parameter;
|
||||
@ -15,6 +10,11 @@ import com.massivecraft.massivecore.pager.Stringifier;
|
||||
import com.massivecraft.massivecore.util.TimeDiffUtil;
|
||||
import com.massivecraft.massivecore.util.TimeUnit;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.Invitation;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@ -42,14 +42,14 @@ public class CmdFactionsInviteList extends FactionsCommand {
|
||||
|
||||
Faction faction = this.readArg(msenderFaction);
|
||||
|
||||
if (faction != msenderFaction && !Perm.INVITE_LIST_OTHER.has(sender, true)) {
|
||||
return;
|
||||
}
|
||||
if (faction != msenderFaction && !Perm.INVITE_LIST_OTHER.has(sender, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// MPerm
|
||||
if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
|
||||
return;
|
||||
}
|
||||
if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Pager Create
|
||||
final List<Entry<String, Invitation>> invitations = new MassiveList<>(faction.getInvitations().entrySet());
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.event.EventFactionsInvitedChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.container.TypeSet;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.event.EventFactionsInvitedChange;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -50,9 +50,9 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
|
||||
}
|
||||
|
||||
// MPerm
|
||||
if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
|
||||
return;
|
||||
}
|
||||
if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (MPlayer mplayer : mplayers) {
|
||||
// Already member?
|
||||
@ -63,7 +63,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
|
||||
|
||||
Mson kick = Mson.mson(
|
||||
mson("You might want to kick him. ").color(ChatColor.YELLOW),
|
||||
mson(ChatColor.RED.toString() + tooltip).tooltip(ChatColor.YELLOW.toString() + tooltip).suggest(command)
|
||||
mson(ChatColor.RED + tooltip).tooltip(ChatColor.YELLOW + tooltip).suggest(command)
|
||||
);
|
||||
|
||||
// Inform
|
||||
@ -79,9 +79,9 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
|
||||
// Event
|
||||
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, msenderFaction, isInvited);
|
||||
event.run();
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
isInvited = event.isNewInvited();
|
||||
|
||||
// Inform Player
|
||||
@ -96,9 +96,9 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
|
||||
msenderFaction.uninvite(mplayer);
|
||||
|
||||
// If all, we do this at last. So we only do it once.
|
||||
if (!all) {
|
||||
msenderFaction.changed();
|
||||
}
|
||||
if (!all) {
|
||||
msenderFaction.changed();
|
||||
}
|
||||
} else {
|
||||
// Mson
|
||||
String command = CmdFactions.get().cmdFactionsInvite.cmdFactionsInviteAdd.getCommandLine(mplayer.getName());
|
||||
@ -106,7 +106,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
|
||||
|
||||
Mson invite = Mson.mson(
|
||||
mson("You might want to invite him. ").color(ChatColor.YELLOW),
|
||||
mson(ChatColor.GREEN.toString() + tooltip).tooltip(ChatColor.YELLOW.toString() + tooltip).suggest(command)
|
||||
mson(ChatColor.GREEN + tooltip).tooltip(ChatColor.YELLOW + tooltip).suggest(command)
|
||||
);
|
||||
|
||||
// Inform
|
||||
|
@ -1,5 +1,8 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
@ -9,9 +12,6 @@ import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MFlag;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdFactionsJoin extends FactionsCommand {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
@ -8,8 +10,6 @@ import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdFactionsKick extends FactionsCommand {
|
||||
|
@ -1,15 +1,15 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.comparator.ComparatorFactionList;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.FactionColl;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.Parameter;
|
||||
import com.massivecraft.massivecore.pager.Pager;
|
||||
import com.massivecraft.massivecore.pager.Stringifier;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.comparator.ComparatorFactionList;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.FactionColl;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.util.AsciiMap;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.util.AsciiMap;
|
||||
|
||||
public class CmdFactionsMap extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class CmdFactionsMoneyBalance extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
@ -28,9 +28,9 @@ public class CmdFactionsMoneyBalance extends FactionsCommand {
|
||||
public void perform() throws MassiveException {
|
||||
Faction faction = this.readArg(msenderFaction);
|
||||
|
||||
if (faction != msenderFaction && !Perm.MONEY_BALANCE_ANY.has(sender, true)) {
|
||||
return;
|
||||
}
|
||||
if (faction != msenderFaction && !Perm.MONEY_BALANCE_ANY.has(sender, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Econ.sendBalanceInfo(msender, faction);
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdFactionsMoneyDeposit extends FactionsCommand {
|
||||
|
@ -1,15 +1,15 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdFactionsMoneyTransferF2f extends FactionsCommand {
|
||||
|
@ -1,5 +1,9 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
@ -8,10 +12,6 @@ import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdFactionsMoneyTransferF2p extends FactionsCommand {
|
||||
|
@ -1,5 +1,9 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
@ -8,10 +12,6 @@ import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdFactionsMoneyTransferP2f extends FactionsCommand {
|
||||
|
@ -1,5 +1,9 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
@ -7,10 +11,6 @@ import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdFactionsMoneyWithdraw extends FactionsCommand {
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.FactionColl;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.Visibility;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeStringConfirmation;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
import com.massivecraft.massivecore.util.ConfirmationUtil;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.FactionColl;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
|
||||
public class CmdFactionsMoneyconvert extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.event.EventFactionsMotdChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.TypeNullable;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
import com.massivecraft.massivecore.mixin.MixinDisplayName;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.event.EventFactionsMotdChange;
|
||||
|
||||
public class CmdFactionsMotd extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeFactionNameLenient;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.event.EventFactionsNameChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class CmdFactionsName extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
@ -29,16 +29,16 @@ public class CmdFactionsName extends FactionsCommand {
|
||||
Faction faction = this.readArg(msenderFaction);
|
||||
|
||||
// MPerm
|
||||
if (!MPerm.getPermName().has(msender, faction, true)) {
|
||||
return;
|
||||
}
|
||||
if (!MPerm.getPermName().has(msender, faction, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Event
|
||||
EventFactionsNameChange event = new EventFactionsNameChange(sender, faction, newName);
|
||||
event.run();
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
newName = event.getNewName();
|
||||
|
||||
// Apply
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Factions;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
|
||||
public class CmdFactionsOverride extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -5,10 +5,10 @@ public class CmdFactionsPerm extends FactionsCommand {
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
CmdFactionsPermList cmdFactionsPermList = new CmdFactionsPermList();
|
||||
CmdFactionsPermShow cmdFactionsPermShow = new CmdFactionsPermShow();
|
||||
CmdFactionsPermView cmdFactionsPermView = new CmdFactionsPermView();
|
||||
CmdFactionsPermViewall cmdFactionsPermViewall = new CmdFactionsPermViewall();
|
||||
CmdFactionsPermSet cmdFactionsPermSet = new CmdFactionsPermSet();
|
||||
final CmdFactionsPermList cmdFactionsPermList = new CmdFactionsPermList();
|
||||
final CmdFactionsPermShow cmdFactionsPermShow = new CmdFactionsPermShow();
|
||||
final CmdFactionsPermView cmdFactionsPermView = new CmdFactionsPermView();
|
||||
final CmdFactionsPermViewall cmdFactionsPermViewall = new CmdFactionsPermViewall();
|
||||
final CmdFactionsPermSet cmdFactionsPermSet = new CmdFactionsPermSet();
|
||||
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPermColl;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.Parameter;
|
||||
import com.massivecraft.massivecore.pager.Pager;
|
||||
import com.massivecraft.massivecore.pager.Stringifier;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPermColl;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,5 +1,8 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPerm;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPermable;
|
||||
@ -7,9 +10,6 @@ import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.event.EventFactionsPermChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdFactionsPermSet extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
@ -38,9 +38,9 @@ public class CmdFactionsPermSet extends FactionsCommand {
|
||||
MPerm.MPermable permable = TypeMPermable.get(faction).read(this.argAt(1), sender);
|
||||
|
||||
// Do the sender have the right to change perms for this faction?
|
||||
if (!MPerm.getPermPerms().has(msender, faction, true)) {
|
||||
return;
|
||||
}
|
||||
if (!MPerm.getPermPerms().has(msender, faction, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Is this perm editable?
|
||||
if (!msender.isOverriding() && !perm.isEditable()) {
|
||||
@ -54,9 +54,9 @@ public class CmdFactionsPermSet extends FactionsCommand {
|
||||
// Event
|
||||
EventFactionsPermChange event = new EventFactionsPermChange(sender, faction, perm, permable, value);
|
||||
event.run();
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
value = event.getNewValue();
|
||||
|
||||
// Apply
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPerm;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
@ -1,16 +1,16 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPermable;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.List;
|
||||
@ -45,9 +45,9 @@ public class CmdFactionsPermView extends FactionsCommand {
|
||||
List<MPerm> perms = new MassiveList<>();
|
||||
|
||||
for (MPerm mperm : MPerm.getAll()) {
|
||||
if (faction.isPermitted(permable.getId(), mperm.getId())) {
|
||||
perms.add(mperm);
|
||||
}
|
||||
if (faction.isPermitted(permable.getId(), mperm.getId())) {
|
||||
perms.add(mperm);
|
||||
}
|
||||
}
|
||||
|
||||
if (perms.isEmpty()) {
|
||||
@ -60,31 +60,28 @@ public class CmdFactionsPermView extends FactionsCommand {
|
||||
String permissionSingularPlural = permNames.size() == 1 ? "permission" : "permissions";
|
||||
msg("<i>In <reset>%s <reset>%s <i>specifically has the %s: <reset>%s<i>.", faction.describeTo(msender), permable.getDisplayName(sender), permissionSingularPlural, names);
|
||||
}
|
||||
if (permable instanceof MPlayer) {
|
||||
MPlayer mplayer = (MPlayer) permable;
|
||||
if (permable instanceof MPlayer mplayer) {
|
||||
msg("<i>They may have other permissions through their faction membership, rank or relation to <reset>%s<i>.", faction.describeTo(msender));
|
||||
|
||||
List<Mson> msons = new MassiveList<>();
|
||||
|
||||
if (mplayer.getFaction() != faction) {
|
||||
msons.add(Mson.parse("<command>[faction]").command(this, mplayer.getFaction().getName(), faction.getName()));
|
||||
}
|
||||
if (mplayer.getFaction() != faction) {
|
||||
msons.add(Mson.parse("<command>[faction]").command(this, mplayer.getFaction().getName(), faction.getName()));
|
||||
}
|
||||
msons.add(Mson.parse("<command>[rank]").command(this, mplayer.getFaction().getName() + "-" + mplayer.getRank().getName(), faction.getName()));
|
||||
if (mplayer.getFaction() != faction) {
|
||||
msons.add(Mson.parse("<command>[relation]").command(this, faction.getRelationTo(mplayer).toString(), faction.getName()));
|
||||
}
|
||||
if (mplayer.getFaction() != faction) {
|
||||
msons.add(Mson.parse("<command>[relation]").command(this, faction.getRelationTo(mplayer).toString(), faction.getName()));
|
||||
}
|
||||
Mson msons2 = Mson.implode(msons, Mson.SPACE);
|
||||
message(mson(mson("Commands: ").color(ChatColor.YELLOW), msons2));
|
||||
}
|
||||
if (permable instanceof Faction) {
|
||||
Faction faction1 = (Faction) permable;
|
||||
if (permable instanceof Faction faction1) {
|
||||
msg("<i>They may have other permissions through their relation to <reset>%s<i>.", faction.describeTo(msender));
|
||||
Mson msonRelation = Mson.parse("<command>[relation]").command(this, faction.getRelationTo(faction1).toString(), faction.getName());
|
||||
Mson msons = Mson.implode(MUtil.list(msonRelation), Mson.SPACE);
|
||||
message(mson(mson("Commands: ").color(ChatColor.YELLOW), msons));
|
||||
}
|
||||
if (permable instanceof Rank && !faction.hasRank((Rank) permable)) {
|
||||
Rank rank = (Rank) permable;
|
||||
if (permable instanceof Rank rank && !faction.hasRank((Rank) permable)) {
|
||||
msg("<i>They may have other permissions thorugh their faction membership or relation to <reset>%s<i>.", faction.describeTo(msender));
|
||||
Mson msonFaction = Mson.parse("<command>[faction]").command(this, rank.getFaction().getName(), faction.getName());
|
||||
Mson msonRelation = Mson.parse("<command>[relation]").command(this, faction.getRelationTo(rank.getFaction()).toString(), faction.getName());
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPermable;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -44,18 +44,15 @@ public class CmdFactionsPermViewall extends FactionsCommand {
|
||||
List<MPerm.MPermable> permables = new MassiveList<>();
|
||||
permables.add(permable);
|
||||
|
||||
if (permable instanceof MPlayer) {
|
||||
MPlayer mplayer = (MPlayer) permable;
|
||||
if (permable instanceof MPlayer mplayer) {
|
||||
permables.add(mplayer.getFaction());
|
||||
permables.add(mplayer.getRank());
|
||||
permables.add(faction.getRelationTo(mplayer));
|
||||
}
|
||||
if (permable instanceof Faction) {
|
||||
Faction faction1 = (Faction) permable;
|
||||
if (permable instanceof Faction faction1) {
|
||||
permables.add(faction.getRelationTo(faction1));
|
||||
}
|
||||
if (permable instanceof Rank && !faction.hasRank((Rank) permable)) {
|
||||
Rank rank = (Rank) permable;
|
||||
if (permable instanceof Rank rank && !faction.hasRank((Rank) permable)) {
|
||||
Faction faction1 = rank.getFaction();
|
||||
permables.add(faction1);
|
||||
permables.add(faction.getRelationTo(faction1));
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.Progressbar;
|
||||
import com.massivecraft.massivecore.event.EventMassiveCorePlayerCleanInactivityToleranceMillis;
|
||||
import com.massivecraft.massivecore.util.TimeDiffUtil;
|
||||
import com.massivecraft.massivecore.util.TimeUnit;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
@ -5,8 +5,8 @@ public class CmdFactionsPowerboost extends FactionsCommand {
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdFactionsPowerboostPlayer cmdFactionsPowerBoostPlayer = new CmdFactionsPowerboostPlayer();
|
||||
public CmdFactionsPowerboostFaction cmdFactionsPowerBoostFaction = new CmdFactionsPowerboostFaction();
|
||||
public final CmdFactionsPowerboostPlayer cmdFactionsPowerBoostPlayer = new CmdFactionsPowerboostPlayer();
|
||||
public final CmdFactionsPowerboostFaction cmdFactionsPowerBoostFaction = new CmdFactionsPowerboostFaction();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.FactionsParticipator;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.Type;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.FactionsParticipator;
|
||||
|
||||
public abstract class CmdFactionsPowerboostAbstract extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -5,7 +5,7 @@ public class CmdFactionsRank extends FactionsCommand {
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdFactionsRankSet cmdFactionsRankSet = new CmdFactionsRankSet();
|
||||
public final CmdFactionsRankSet cmdFactionsRankSet = new CmdFactionsRankSet();
|
||||
public CmdFactionsRankShow cmdFactionsRankShow = new CmdFactionsRankShow();
|
||||
public CmdFactionsRankList cmdFactionsRankList = new CmdFactionsRankList();
|
||||
public CmdFactionsRankEdit cmdFactionsRankEdit = new CmdFactionsRankEdit();
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
|
||||
public class CmdFactionsRankEdit extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeStringParsed;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeRank;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -34,7 +34,7 @@ public class CmdFactionsRankEditDelete extends FactionsCommand {
|
||||
Faction faction = this.readArgAt(1, msenderFaction);
|
||||
|
||||
// Rank if any passed.
|
||||
TypeRank typeRank = new TypeRank(faction);
|
||||
TypeRank typeRank = TypeRank.get(faction, null);
|
||||
Rank rank = typeRank.read(this.argAt(0), sender);
|
||||
|
||||
CmdFactionsRankEdit.ensureAllowed(msender, faction, "delete");
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeRank;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -32,7 +32,7 @@ public class CmdFactionsRankEditName extends FactionsCommand {
|
||||
Faction faction = this.readArgAt(2, msenderFaction);
|
||||
|
||||
// Rank if any passed.
|
||||
TypeRank typeRank = new TypeRank(faction);
|
||||
TypeRank typeRank = TypeRank.get(faction, null);
|
||||
Rank rank = typeRank.read(this.argAt(0), sender);
|
||||
|
||||
// Args
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeRank;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeString;
|
||||
|
||||
public class CmdFactionsRankEditPrefix extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
@ -30,7 +30,7 @@ public class CmdFactionsRankEditPrefix extends FactionsCommand {
|
||||
Faction faction = this.readArgAt(2, msenderFaction);
|
||||
|
||||
// Rank if any passed.
|
||||
TypeRank typeRank = new TypeRank(faction);
|
||||
TypeRank typeRank = TypeRank.get(faction, null);
|
||||
Rank rank = typeRank.read(this.argAt(0), sender);
|
||||
|
||||
// Args
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeRank;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -32,7 +32,7 @@ public class CmdFactionsRankEditPriority extends FactionsCommand {
|
||||
Faction faction = this.readArgAt(2, msenderFaction);
|
||||
|
||||
// Rank if any passed.
|
||||
TypeRank typeRank = new TypeRank(faction);
|
||||
TypeRank typeRank = TypeRank.get(faction, null);
|
||||
Rank rank = typeRank.read(this.argAt(0), sender);
|
||||
|
||||
CmdFactionsRankEdit.ensureAllowed(msender, faction, "edit");
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.Parameter;
|
||||
import com.massivecraft.massivecore.pager.Pager;
|
||||
import com.massivecraft.massivecore.pager.Stringifier;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
import com.massivecraft.massivecore.command.Visibility;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
|
||||
public class CmdFactionsRankOld extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -1,5 +1,8 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
@ -13,9 +16,6 @@ import net.knarcraft.factions.entity.MPlayerColl;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import net.knarcraft.factions.event.EventFactionsMembershipChange;
|
||||
import net.knarcraft.factions.event.EventFactionsRankChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -75,9 +75,9 @@ public class CmdFactionsRankSet extends FactionsCommand {
|
||||
// Event
|
||||
EventFactionsRankChange event = new EventFactionsRankChange(sender, target, rank);
|
||||
event.run();
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
rank = event.getNewRank();
|
||||
|
||||
// Change the rank.
|
||||
@ -135,9 +135,9 @@ public class CmdFactionsRankSet extends FactionsCommand {
|
||||
|
||||
private void ensureAllowed() throws MassiveException {
|
||||
// People with permission don't follow the normal rules.
|
||||
if (msender.isOverriding()) {
|
||||
return;
|
||||
}
|
||||
if (msender.isOverriding()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If somone gets the leadership of wilderness (Which has happened before).
|
||||
// We can at least try to limit their powers.
|
||||
@ -204,9 +204,9 @@ public class CmdFactionsRankSet extends FactionsCommand {
|
||||
// Event
|
||||
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, msender, endFaction, EventFactionsMembershipChange.MembershipChangeReason.RANK);
|
||||
membershipChangeEvent.run();
|
||||
if (membershipChangeEvent.isCancelled()) {
|
||||
throw new MassiveException();
|
||||
}
|
||||
if (membershipChangeEvent.isCancelled()) {
|
||||
throw new MassiveException();
|
||||
}
|
||||
|
||||
// Apply
|
||||
target.resetFactionData();
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.cmd.type.TypeMPlayer;
|
||||
import net.knarcraft.factions.entity.MPlayer;
|
||||
import net.knarcraft.factions.entity.Rank;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdFactionsRankShow extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -5,7 +5,7 @@ public class CmdFactionsRelation extends FactionsCommand {
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdFactionsRelationSet cmdFactionsRelationSet = new CmdFactionsRelationSet();
|
||||
public final CmdFactionsRelationSet cmdFactionsRelationSet = new CmdFactionsRelationSet();
|
||||
public CmdFactionsRelationList cmdFactionsRelationList = new CmdFactionsRelationList();
|
||||
public CmdFactionsRelationWishes cmdFactionsRelationWishes = new CmdFactionsRelationWishes();
|
||||
|
||||
|
@ -1,11 +1,5 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.Rel;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeRelation;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
@ -14,6 +8,12 @@ import com.massivecraft.massivecore.command.type.container.TypeSet;
|
||||
import com.massivecraft.massivecore.pager.Pager;
|
||||
import com.massivecraft.massivecore.pager.Stringifier;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.Rel;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeRelation;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.FactionColl;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.Visibility;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
|
||||
public class CmdFactionsRelationOld extends FactionsCommand {
|
||||
// -------------------------------------------- //
|
||||
|
@ -1,5 +1,8 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.MassiveCommand;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import net.knarcraft.factions.Rel;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.cmd.type.TypeRelation;
|
||||
@ -7,9 +10,6 @@ import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MFlag;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import net.knarcraft.factions.event.EventFactionsRelationChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.MassiveCommand;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdFactionsRelationSet extends FactionsCommand {
|
||||
@ -34,9 +34,9 @@ public class CmdFactionsRelationSet extends FactionsCommand {
|
||||
Rel newRelation = this.readArg();
|
||||
|
||||
// MPerm
|
||||
if (!MPerm.getPermRel().has(msender, msenderFaction, true)) {
|
||||
return;
|
||||
}
|
||||
if (!MPerm.getPermRel().has(msender, msenderFaction, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Verify
|
||||
if (otherFaction == msenderFaction) {
|
||||
@ -49,9 +49,9 @@ public class CmdFactionsRelationSet extends FactionsCommand {
|
||||
// Event
|
||||
EventFactionsRelationChange event = new EventFactionsRelationChange(sender, msenderFaction, otherFaction, newRelation);
|
||||
event.run();
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
newRelation = event.getNewRelation();
|
||||
|
||||
// try to set the new relation
|
||||
|
@ -1,10 +1,5 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.Rel;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveMap;
|
||||
import com.massivecraft.massivecore.command.Parameter;
|
||||
@ -12,6 +7,11 @@ import com.massivecraft.massivecore.pager.Pager;
|
||||
import com.massivecraft.massivecore.pager.Stringifier;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
import net.knarcraft.factions.Factions;
|
||||
import net.knarcraft.factions.Rel;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.FactionColl;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.util.AsciiMap;
|
||||
import net.knarcraft.factions.util.VisualizeUtil;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
|
||||
import net.knarcraft.factions.util.AsciiMap;
|
||||
import net.knarcraft.factions.util.VisualizeUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -56,7 +56,7 @@ public class CmdFactionsSeeChunkOld extends FactionsCommand {
|
||||
showPillar(me, world, blockX, blockZ);
|
||||
|
||||
// Inform
|
||||
boolean showCoords = AsciiMap.showChunkCoords(chunk);
|
||||
boolean showCoords = AsciiMap.showChunkCoordinates(chunk);
|
||||
String chunkDesc = showCoords ? chunk.toString(PSFormatHumanSpace.get()) : "chunk";
|
||||
msg("<i>Visualized %s", chunkDesc);
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.entity.Board;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||
import com.massivecraft.massivecore.mixin.MixinWorld;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.entity.Board;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.cmd.type.TypeFaction;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.FactionColl;
|
||||
import net.knarcraft.factions.entity.MPerm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.ChunkUtil;
|
||||
import net.knarcraft.factions.Perm;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -1,14 +1,13 @@
|
||||
package net.knarcraft.factions.cmd;
|
||||
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.ChunkUtil;
|
||||
import net.knarcraft.factions.Perm;
|
||||
import net.knarcraft.factions.entity.BoardColl;
|
||||
import net.knarcraft.factions.entity.Faction;
|
||||
import net.knarcraft.factions.entity.MConf;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
@ -41,7 +40,7 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple {
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public Set<PS> getChunks() throws MassiveException {
|
||||
public Set<PS> getChunks() {
|
||||
// Common Startup
|
||||
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user