More refactoring... the commands are refactored now :)
This commit is contained in:
parent
0b96a821ce
commit
d7c1d0fce3
@ -1,3 +1,3 @@
|
||||
name: Factions
|
||||
version: 1.0 beta7
|
||||
version: 1.0 beta8
|
||||
main: com.bukkit.mcteam.factions.Factions
|
@ -124,7 +124,7 @@ public class Board {
|
||||
* north is in the direction of decreasing x
|
||||
* east is in the direction of decreasing z
|
||||
*/
|
||||
public ArrayList<String> getMap(Faction faction, FLocation flocation, double inDegrees) {
|
||||
public static ArrayList<String> getMap(Faction faction, FLocation flocation, double inDegrees) {
|
||||
ArrayList<String> ret = new ArrayList<String>();
|
||||
ret.add(TextUtil.titleize("("+flocation+") "+getFactionAt(flocation).getTag(faction)));
|
||||
|
||||
|
@ -14,11 +14,23 @@ import com.bukkit.mcteam.factions.struct.Role;
|
||||
import com.bukkit.mcteam.gson.reflect.TypeToken;
|
||||
import com.bukkit.mcteam.util.DiscUtil;
|
||||
|
||||
/**
|
||||
* Logged in players always have exactly one FPlayer instance.
|
||||
* Logged out players may or may not have an FPlayer instance. They will always have one if they are part of a faction.
|
||||
* This is because only players with a faction are saved to disk (in order to not waste disk space).
|
||||
*
|
||||
* The FPlayer is linked to a minecraft player using the player name in lowercase form.
|
||||
* Lowercase is enforced while loading from disk TODO
|
||||
*
|
||||
* The same instance is always returned for the same player.
|
||||
* This means you can use the == operator. No .equals method necessary.
|
||||
*/
|
||||
|
||||
public class FPlayer {
|
||||
public static transient Map<String, FPlayer> instances = new HashMap<String, FPlayer>();
|
||||
public static transient File file = new File(Factions.instance.getDataFolder(), "players.json");
|
||||
|
||||
public transient String playername;
|
||||
public transient String playerName;
|
||||
public transient FLocation lastStoodAt = new FLocation(); // Where did this player stand the last time we checked?
|
||||
|
||||
public int factionId;
|
||||
@ -26,15 +38,15 @@ public class FPlayer {
|
||||
private String title;
|
||||
private double power;
|
||||
private long lastPowerUpdateTime;
|
||||
private boolean mapAutoUpdating;
|
||||
private transient boolean mapAutoUpdating;
|
||||
private boolean factionChatting;
|
||||
|
||||
public FPlayer(Player player) {
|
||||
this.playername = player.getName();
|
||||
this.playerName = player.getName().toLowerCase();
|
||||
}
|
||||
|
||||
public FPlayer(String playername) {
|
||||
this.playername = playername;
|
||||
public FPlayer(String playerName) {
|
||||
this.playerName = playerName.toLowerCase();
|
||||
}
|
||||
|
||||
// GSON need this noarg constructor.
|
||||
@ -53,11 +65,11 @@ public class FPlayer {
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return Factions.instance.getServer().getPlayer(playername);
|
||||
return Factions.instance.getServer().getPlayer(playerName);
|
||||
}
|
||||
|
||||
public String getPlayerName() {
|
||||
return this.playername;
|
||||
return this.playerName;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -65,7 +77,7 @@ public class FPlayer {
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean isOnline() {
|
||||
return Factions.instance.getServer().getPlayer(playername) != null;
|
||||
return Factions.instance.getServer().getPlayer(playerName) != null;
|
||||
}
|
||||
|
||||
public boolean isOffline() {
|
||||
@ -109,7 +121,7 @@ public class FPlayer {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.playername;
|
||||
return this.playerName;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
@ -316,70 +328,17 @@ public class FPlayer {
|
||||
return factionId != 0;
|
||||
}
|
||||
|
||||
public ArrayList<String> invite(FPlayer follower) {
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
|
||||
//Log.debug("this.role: "+this.role);
|
||||
//Log.debug("this.role.value: "+this.role.value);
|
||||
//Log.debug("FactionRole.MODERATOR.value: "+FactionRole.MODERATOR.value);
|
||||
|
||||
if (this.role.value < Role.MODERATOR.value) {
|
||||
errors.add(Conf.colorSystem+"You must be a moderator to invite.");
|
||||
}
|
||||
|
||||
if(errors.size() > 0) {
|
||||
return errors;
|
||||
}
|
||||
|
||||
return this.getFaction().invite(follower);
|
||||
}
|
||||
|
||||
public ArrayList<String> deinvite(FPlayer follower) {
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
|
||||
if (this.role.value < Role.MODERATOR.value) {
|
||||
errors.add(Conf.colorSystem+"You must be a moderator to deinvite.");
|
||||
}
|
||||
|
||||
if(errors.size() > 0) {
|
||||
return errors;
|
||||
}
|
||||
|
||||
return this.getFaction().deinvite(follower);
|
||||
}
|
||||
|
||||
public ArrayList<String> kick(FPlayer follower) {
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
|
||||
if ( ! follower.getFaction().equals(this.getFaction())) {
|
||||
errors.add(follower.getNameAndRelevant(this)+Conf.colorSystem+" is not a member of "+Conf.colorMember+this.getFaction().getTag());
|
||||
} else if (follower.equals(this)) {
|
||||
errors.add(Conf.colorSystem+"You cannot kick yourself.");
|
||||
errors.add(Conf.colorSystem+"You might want to "+Conf.colorCommand+Conf.aliasBase.get(0)+" "+Conf.aliasLeave.get(0));
|
||||
} else if (follower.role.value >= this.role.value) { // TODO add more informative messages.
|
||||
errors.add(Conf.colorSystem+"Your rank is too low to kick this player.");
|
||||
}
|
||||
|
||||
if(errors.size() > 0) {
|
||||
return errors;
|
||||
}
|
||||
|
||||
return follower.getFaction().kick(follower);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// Get and search
|
||||
// You can only get a "skin" for online players.
|
||||
// The same object is always returned for the same player.
|
||||
// This means you can use the == operator. No .equals method necessary.
|
||||
// -------------------------------------------- //
|
||||
public static FPlayer get(String playername) {
|
||||
if (instances.containsKey(playername)) {
|
||||
return instances.get(playername);
|
||||
public static FPlayer get(String playerName) {
|
||||
playerName = playerName.toLowerCase();
|
||||
if (instances.containsKey(playerName)) {
|
||||
return instances.get(playerName);
|
||||
}
|
||||
|
||||
FPlayer vplayer = new FPlayer(playername);
|
||||
instances.put(playername, vplayer);
|
||||
FPlayer vplayer = new FPlayer(playerName);
|
||||
instances.put(playerName, vplayer);
|
||||
return vplayer;
|
||||
}
|
||||
|
||||
@ -460,7 +419,12 @@ public class FPlayer {
|
||||
|
||||
try {
|
||||
Type type = new TypeToken<Map<String, FPlayer>>(){}.getType();
|
||||
instances = Factions.gson.fromJson(DiscUtil.read(file), type);
|
||||
Map<String, FPlayer> instancesFromFile = Factions.gson.fromJson(DiscUtil.read(file), type);
|
||||
|
||||
instances = new HashMap<String, FPlayer>();
|
||||
for (Entry<String, FPlayer> instanceFromFile : instancesFromFile.entrySet()) {
|
||||
instances.put(instanceFromFile.getKey().toLowerCase(), instanceFromFile.getValue());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
@ -473,7 +437,7 @@ public class FPlayer {
|
||||
|
||||
public static void fillPlayernames() {
|
||||
for(Entry<String, FPlayer> entry : instances.entrySet()) {
|
||||
entry.getValue().playername = entry.getKey();
|
||||
entry.getValue().playerName = entry.getKey();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class Faction {
|
||||
|
||||
public transient int id;
|
||||
protected Map<Integer, Relation> relationWish;
|
||||
protected Set<String> invites; // Where string is a follower id (lower case name)
|
||||
public Set<String> invites; // Where string is a follower id (lower case name)
|
||||
protected boolean open;
|
||||
protected String tag;
|
||||
protected String description;
|
||||
@ -118,7 +118,7 @@ public class Faction {
|
||||
// -------------------------------
|
||||
|
||||
|
||||
public ArrayList<String> invite(FPlayer follower) { // TODO Move out
|
||||
/*public ArrayList<String> invite(FPlayer follower) { // TODO Move out
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
|
||||
if (follower.getFaction().equals(this)) { // error här?
|
||||
@ -149,7 +149,7 @@ public class Faction {
|
||||
this.invites.remove(follower.id);
|
||||
this.save();
|
||||
return errors;
|
||||
}
|
||||
}*/
|
||||
|
||||
public ArrayList<String> kick(FPlayer follower) {
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
@ -198,6 +198,7 @@ public class Faction {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
public void removeFollower(FPlayer follower) {
|
||||
if (this.id != follower.factionId) {
|
||||
return; // safety check
|
||||
@ -207,7 +208,7 @@ public class Faction {
|
||||
follower.resetFactionData();
|
||||
follower.save();
|
||||
this.save();
|
||||
}
|
||||
}*/
|
||||
|
||||
public ArrayList<Player> getOnlinePlayers() {
|
||||
ArrayList<Player> ret = new ArrayList<Player>();
|
||||
|
@ -16,7 +16,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.bukkit.mcteam.factions.commands.FCommand;
|
||||
import com.bukkit.mcteam.factions.commands.FBaseCommand;
|
||||
import com.bukkit.mcteam.factions.listeners.FactionsBlockListener;
|
||||
import com.bukkit.mcteam.factions.listeners.FactionsEntityListener;
|
||||
import com.bukkit.mcteam.factions.listeners.FactionsPlayerListener;
|
||||
@ -47,7 +47,7 @@ public class Factions extends JavaPlugin {
|
||||
public static Help helpPlugin;
|
||||
|
||||
// Commands
|
||||
public List<FCommand> commands = new ArrayList<FCommand>();
|
||||
public List<FBaseCommand> commands = new ArrayList<FBaseCommand>();
|
||||
|
||||
public Factions() {
|
||||
Factions.instance = this;
|
||||
@ -106,12 +106,12 @@ public class Factions extends JavaPlugin {
|
||||
// -------------------------------------------- //
|
||||
|
||||
private void setupPermissions() {
|
||||
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||
|
||||
if (Permissions != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||
|
||||
if (test != null) {
|
||||
Permissions = ((Permissions)test).getHandler();
|
||||
Factions.log("Found and will use plugin "+((Permissions)test).getDescription().getFullName());
|
||||
@ -121,21 +121,18 @@ public class Factions extends JavaPlugin {
|
||||
}
|
||||
|
||||
private void setupHelp() {
|
||||
Plugin test = this.getServer().getPluginManager().getPlugin("Help");
|
||||
|
||||
if (helpPlugin != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin test = this.getServer().getPluginManager().getPlugin("Help");
|
||||
|
||||
if (test != null) {
|
||||
helpPlugin = ((Help) test);
|
||||
Factions.log("Found and will use plugin "+helpPlugin.getDescription().getFullName());
|
||||
for(FCommand fcommand : commands) {
|
||||
fcommand.helpRegister();
|
||||
}
|
||||
helpPlugin.registerCommand("help vampire", "help for the vampire plugin.", helpPlugin, true);
|
||||
} else {
|
||||
Factions.log(Level.WARNING, "'Help' plugin isn't detected. No /help support.");
|
||||
|
||||
// TODO not hardcoded:
|
||||
helpPlugin.registerCommand("f help *[page]", "Factions plugin help.", helpPlugin, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,7 +157,7 @@ public class Factions extends JavaPlugin {
|
||||
String commandName = parameters.get(0).toLowerCase();
|
||||
parameters.remove(0);
|
||||
|
||||
for (FCommand fcommand : this.commands) {
|
||||
for (FBaseCommand fcommand : this.commands) {
|
||||
if (fcommand.getAliases().contains(commandName)) {
|
||||
fcommand.execute(sender, parameters);
|
||||
return;
|
||||
|
@ -11,8 +11,9 @@ import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.Factions;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
import com.bukkit.mcteam.factions.util.TextUtil;
|
||||
|
||||
public class FCommand {
|
||||
public class FBaseCommand {
|
||||
public List<String> requiredParameters;
|
||||
public List<String> optionalParameters;
|
||||
|
||||
@ -29,7 +30,7 @@ public class FCommand {
|
||||
public List<String> parameters;
|
||||
|
||||
|
||||
public FCommand() {
|
||||
public FBaseCommand() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
|
||||
@ -81,10 +82,6 @@ public class FCommand {
|
||||
|
||||
}
|
||||
|
||||
public void helpRegister() {
|
||||
Factions.helpPlugin.registerCommand(this.getBaseName()+ " " +this.helpNameAndParams, this.helpDescription, Factions.instance, false, permissions);
|
||||
}
|
||||
|
||||
public void sendMessage(String message) {
|
||||
sender.sendMessage(Conf.colorSystem+message);
|
||||
}
|
||||
@ -96,6 +93,7 @@ public class FCommand {
|
||||
}
|
||||
|
||||
// Test if the number of params is correct.
|
||||
// TODO print usage
|
||||
public boolean validateCall() {
|
||||
if( ! testPermission(sender)) {
|
||||
sendMessage("You do not have sufficient permissions to use this command.");
|
||||
@ -108,13 +106,7 @@ public class FCommand {
|
||||
}
|
||||
|
||||
if (parameters.size() < requiredParameters.size()) {
|
||||
int missing = requiredParameters.size() - parameters.size();
|
||||
sendMessage("Missing parameters. You must enter "+missing+" more.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parameters.size() > requiredParameters.size() + optionalParameters.size()) {
|
||||
sendMessage("To many parameters.");
|
||||
sendMessage("Usage: "+this.getUseageTemplate(true));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -142,6 +134,65 @@ public class FCommand {
|
||||
return Factions.Permissions.has(player, this.permissions);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// Help and usage description
|
||||
// -------------------------------------------- //
|
||||
public String getUseageTemplate(boolean withColor) {
|
||||
String ret = "";
|
||||
|
||||
if (withColor) {
|
||||
ret += Conf.colorCommand;
|
||||
}
|
||||
|
||||
ret += this.getBaseName()+ " " +TextUtil.implode(this.getAliases(), ",")+" ";
|
||||
|
||||
List<String> parts = new ArrayList<String>();
|
||||
|
||||
for (String requiredParameter : this.requiredParameters) {
|
||||
parts.add("["+requiredParameter+"]");
|
||||
}
|
||||
|
||||
for (String optionalParameter : this.optionalParameters) {
|
||||
parts.add("*["+optionalParameter+"]");
|
||||
}
|
||||
|
||||
if (withColor) {
|
||||
ret += Conf.colorParameter;
|
||||
}
|
||||
|
||||
ret += TextUtil.implode(parts, " ");
|
||||
return ret;
|
||||
}
|
||||
|
||||
public String getUseageTemplate() {
|
||||
return getUseageTemplate(true);
|
||||
}
|
||||
|
||||
public void helpRegister() {
|
||||
Factions.helpPlugin.registerCommand(this.getUseageTemplate(false), this.helpDescription, Factions.instance, false, permissions);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// Assertions
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean assertHasFaction() {
|
||||
if ( ! me.hasFaction()) {
|
||||
sendMessage("You are not member of any faction.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean assertMinRole(Role role) {
|
||||
if (me.role.value < role.value) {
|
||||
sendMessage("You must be "+role+" to "+this.helpDescription+".");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// Commonly used logic
|
||||
// -------------------------------------------- //
|
66
src/com/bukkit/mcteam/factions/commands/FCommandAdmin.java
Normal file
66
src/com/bukkit/mcteam/factions/commands/FCommandAdmin.java
Normal file
@ -0,0 +1,66 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
|
||||
public class FCommandAdmin extends FBaseCommand {
|
||||
|
||||
public FCommandAdmin() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
requiredParameters.add("player name");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Hand over your admin rights";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.ADMIN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if (you.getFaction() != myFaction) {
|
||||
sendMessage(you.getNameAndRelevant(me)+Conf.colorSystem+" is not a member in your faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (you == me) {
|
||||
sendMessage("The target player musn't be yourself.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
me.role = Role.MODERATOR;
|
||||
you.role = Role.ADMIN;
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
if (fplayer.factionId == me.factionId) {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(me)+Conf.colorSystem+" gave "+you.getNameAndRelevant(me)+Conf.colorSystem+" the leadership of your faction.");
|
||||
} else {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" gave "+you.getNameAndRelevant(fplayer)+Conf.colorSystem+" the leadership of "+myFaction.getTag(fplayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
34
src/com/bukkit/mcteam/factions/commands/FCommandChat.java
Normal file
34
src/com/bukkit/mcteam/factions/commands/FCommandChat.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FCommandChat extends FBaseCommand {
|
||||
|
||||
public FCommandChat() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Switch faction only chat on and off";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! me.isFactionChatting()) {
|
||||
// Turn on
|
||||
me.setFactionChatting(true);
|
||||
sendMessage("Faction-only chat ENABLED.");
|
||||
} else {
|
||||
// Turn off
|
||||
me.setFactionChatting(false);
|
||||
sendMessage("Faction-only chat DISABLED.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
78
src/com/bukkit/mcteam/factions/commands/FCommandClaim.java
Normal file
78
src/com/bukkit/mcteam/factions/commands/FCommandClaim.java
Normal file
@ -0,0 +1,78 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Board;
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FLocation;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Relation;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
|
||||
public class FCommandClaim extends FBaseCommand {
|
||||
|
||||
public FCommandClaim() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Claim the land where you are standing";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
FLocation flocation = new FLocation(me);
|
||||
Faction otherFaction = Board.getFactionAt(flocation);
|
||||
|
||||
if (myFaction == otherFaction) {
|
||||
sendMessage("You already own this land.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (myFaction.getLandRounded() >= myFaction.getPowerRounded()) {
|
||||
sendMessage("You can't claim more land! You need more power!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (otherFaction.getRelation(me) == Relation.ALLY) {
|
||||
sendMessage("You can't claim the land of your allies.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (otherFaction.id != 0) {
|
||||
if ( ! otherFaction.hasLandInflation()) { // TODO more messages WARN current faction most importantly
|
||||
sendMessage(me.getRelationColor(otherFaction)+otherFaction.getTag()+Conf.colorSystem+" owns this land and is strong enough to keep it.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! Board.isBorderLocation(flocation)) {
|
||||
sendMessage("You must start claiming land at the border of the territory.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (otherFaction.id == 0) {
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" claimed some new land :D");
|
||||
} else {
|
||||
// ASDF claimed some of your land 450 blocks NNW of you.
|
||||
// ASDf claimed some land from FACTION NAME
|
||||
otherFaction.sendMessage(me.getNameAndRelevant(otherFaction)+Conf.colorSystem+" stole some of your land :O");
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" claimed some land from "+otherFaction.getTag(myFaction));
|
||||
}
|
||||
|
||||
Board.setFactionAt(myFaction, flocation);
|
||||
}
|
||||
|
||||
}
|
@ -7,7 +7,7 @@ import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
|
||||
public class FCommandCreate extends FCommand {
|
||||
public class FCommandCreate extends FBaseCommand {
|
||||
|
||||
public FCommandCreate() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
@ -18,8 +18,7 @@ public class FCommandCreate extends FCommand {
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpNameAndParams = "create [faction tag]";
|
||||
helpDescription = "Create new faction";
|
||||
helpDescription = "Create a new faction";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
|
@ -0,0 +1,54 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
|
||||
public class FCommandDeinvite extends FBaseCommand {
|
||||
|
||||
public FCommandDeinvite() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
requiredParameters.add("player name");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Remove a pending invitation";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getFaction() == myFaction) {
|
||||
sendMessage(you.getName()+" is already a member of "+myFaction.getTag());
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.invites.remove(you.playerName);
|
||||
Faction.save();
|
||||
|
||||
you.sendMessage(me.getNameAndRelevant(you)+Conf.colorSystem+" revoked your invitation to "+myFaction.getTag(you));
|
||||
myFaction.sendMessage(me.getNameAndRelevant(me)+Conf.colorSystem+" revoked "+you.getNameAndRelevant(me)+"'s"+Conf.colorSystem+" invitation.");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
import com.bukkit.mcteam.factions.util.TextUtil;
|
||||
|
||||
public class FCommandDescription extends FBaseCommand {
|
||||
|
||||
public FCommandDescription() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
requiredParameters.add("description");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Change the faction description";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
me.getFaction().setDescription(TextUtil.implode(parameters));
|
||||
// Broadcast the description to everyone
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
fplayer.sendMessage("The faction "+fplayer.getRelationColor(me)+me.getFaction().getTag()+Conf.colorSystem+" changed their description to:");
|
||||
fplayer.sendMessage(me.getFaction().getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
123
src/com/bukkit/mcteam/factions/commands/FCommandHelp.java
Normal file
123
src/com/bukkit/mcteam/factions/commands/FCommandHelp.java
Normal file
@ -0,0 +1,123 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.util.TextUtil;
|
||||
|
||||
public class FCommandHelp extends FBaseCommand {
|
||||
|
||||
public FCommandHelp() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
optionalParameters.add("page");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = false;
|
||||
|
||||
helpDescription = "Display a help page";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
int page = 1;
|
||||
if (parameters.size() > 0) {
|
||||
try {
|
||||
page = Integer.parseInt(parameters.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
// wasn't an integer
|
||||
}
|
||||
}
|
||||
sendMessage(TextUtil.titleize("Factions Help ("+page+"/"+helpPages.size()+")"));
|
||||
page -= 1;
|
||||
if (page < 0 || page >= helpPages.size()) {
|
||||
sendMessage("This page does not exist");
|
||||
return;
|
||||
}
|
||||
sendMessage(helpPages.get(page));
|
||||
}
|
||||
|
||||
//----------------------------------------------//
|
||||
// Build the help pages
|
||||
//----------------------------------------------//
|
||||
|
||||
public static ArrayList<ArrayList<String>> helpPages;
|
||||
|
||||
static {
|
||||
helpPages = new ArrayList<ArrayList<String>>();
|
||||
ArrayList<String> pageLines;
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add( new FCommandHelp().getUseageTemplate() );
|
||||
pageLines.add( new FCommandList().getUseageTemplate() );
|
||||
pageLines.add( new FCommandShow().getUseageTemplate() );
|
||||
pageLines.add( new FCommandMap().getUseageTemplate() );
|
||||
pageLines.add( new FCommandJoin().getUseageTemplate() );
|
||||
pageLines.add( new FCommandLeave().getUseageTemplate() );
|
||||
pageLines.add( new FCommandChat().getUseageTemplate() );
|
||||
pageLines.add( new FCommandCreate().getUseageTemplate() );
|
||||
pageLines.add( new FCommandTag().getUseageTemplate() );
|
||||
pageLines.add( new FCommandDescription().getUseageTemplate() );
|
||||
|
||||
helpPages.add(pageLines);
|
||||
pageLines = new ArrayList<String>();
|
||||
|
||||
pageLines.add( new FCommandOpen().getUseageTemplate() );
|
||||
pageLines.add( new FCommandTitle().getUseageTemplate() );
|
||||
pageLines.add( new FCommandInvite().getUseageTemplate() );
|
||||
pageLines.add( new FCommandDeinvite().getUseageTemplate() );
|
||||
pageLines.add( new FCommandClaim().getUseageTemplate() );
|
||||
pageLines.add( new FCommandUnclaim().getUseageTemplate() );
|
||||
pageLines.add( new FCommandKick().getUseageTemplate() );
|
||||
pageLines.add( new FCommandMod().getUseageTemplate() );
|
||||
pageLines.add( new FCommandAdmin().getUseageTemplate() );
|
||||
|
||||
helpPages.add(pageLines);
|
||||
pageLines = new ArrayList<String>();
|
||||
|
||||
pageLines.add( new FCommandRelationAlly().getUseageTemplate() );
|
||||
pageLines.add( new FCommandRelationNeutral().getUseageTemplate() );
|
||||
pageLines.add( new FCommandRelationEnemy().getUseageTemplate() );
|
||||
pageLines.add("");
|
||||
pageLines.add(Conf.colorSystem+"Set the relation you WISH to have with another faction.");
|
||||
pageLines.add(Conf.colorSystem+"Your default relation with other factions will be neutral.");
|
||||
pageLines.add("");
|
||||
pageLines.add(Conf.colorSystem+"If BOTH factions choose \"ally\" you will be allies.");
|
||||
pageLines.add(Conf.colorSystem+"If ONE faction chooses \"enemy\" you will be enemies.");
|
||||
|
||||
helpPages.add(pageLines);
|
||||
pageLines = new ArrayList<String>();
|
||||
|
||||
pageLines.add(Conf.colorSystem+"You can never hurt members or allies.");
|
||||
pageLines.add(Conf.colorSystem+"You can not hurt neutrals in their own territory.");
|
||||
pageLines.add(Conf.colorSystem+"You can always hurt enemies and players without faction.");
|
||||
pageLines.add("");
|
||||
pageLines.add(Conf.colorSystem+"Damage from enemies is reduced in your own territory.");
|
||||
pageLines.add(Conf.colorSystem+"When you die you lose power. It is restored over time.");
|
||||
pageLines.add(Conf.colorSystem+"The power of a faction is the sum of all member power.");
|
||||
pageLines.add(Conf.colorSystem+"The power of a faction determines how much land it can hold.");
|
||||
pageLines.add(Conf.colorSystem+"You can claim land from factions with too little power.");
|
||||
|
||||
helpPages.add(pageLines);
|
||||
pageLines = new ArrayList<String>();
|
||||
|
||||
pageLines.add(Conf.colorSystem+"Only faction members can build and destroy in their own");
|
||||
pageLines.add(Conf.colorSystem+"territory. Usage of the following items is also restricted:");
|
||||
pageLines.add(Conf.colorSystem+"Door, Chest, Furnace and Dispenser.");
|
||||
pageLines.add(" ");
|
||||
pageLines.add(Conf.colorSystem+"Make sure to put pressure plates in front of doors for your");
|
||||
pageLines.add(Conf.colorSystem+"guest visitors. Otherwise they can't get through. You can ");
|
||||
pageLines.add(Conf.colorSystem+"also use this to create member only areas.");
|
||||
pageLines.add(Conf.colorSystem+"As dispensers are protected, you can create traps without");
|
||||
pageLines.add(Conf.colorSystem+"worrying about those arrows getting stolen.");
|
||||
|
||||
helpPages.add(pageLines);
|
||||
pageLines = new ArrayList<String>();
|
||||
|
||||
pageLines.add( new FCommandVersion().getUseageTemplate() );
|
||||
|
||||
helpPages.add(pageLines);
|
||||
}
|
||||
|
||||
}
|
||||
|
55
src/com/bukkit/mcteam/factions/commands/FCommandInvite.java
Normal file
55
src/com/bukkit/mcteam/factions/commands/FCommandInvite.java
Normal file
@ -0,0 +1,55 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
|
||||
public class FCommandInvite extends FBaseCommand {
|
||||
|
||||
public FCommandInvite() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
requiredParameters.add("player name");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Invite a player";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if (you.getFaction() == myFaction) {
|
||||
sendMessage(you.getName()+" is already a member of "+myFaction.getTag());
|
||||
sendMessage("You might want to "+Conf.colorCommand+Conf.aliasBase.get(0)+" "+Conf.aliasKick.get(0)+Conf.colorParameter+" "+you.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.invites.add(you.playerName);
|
||||
Faction.save();
|
||||
|
||||
you.sendMessage(me.getNameAndRelevant(you)+Conf.colorSystem+" invited you to "+myFaction.getTag(you));
|
||||
myFaction.sendMessage(me.getNameAndRelevant(me)+Conf.colorSystem+" invited "+you.getNameAndRelevant(me)+Conf.colorSystem+" to your faction.");
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,7 @@ import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
|
||||
public class FCommandJoin extends FCommand {
|
||||
public class FCommandJoin extends FBaseCommand {
|
||||
|
||||
public FCommandJoin() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
@ -17,7 +17,6 @@ public class FCommandJoin extends FCommand {
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpNameAndParams = "join [faction name]";
|
||||
helpDescription = "Join a faction";
|
||||
}
|
||||
|
||||
@ -50,7 +49,7 @@ public class FCommandJoin extends FCommand {
|
||||
|
||||
me.resetFactionData();
|
||||
me.factionId = faction.id;
|
||||
faction.deinvite(me);
|
||||
faction.invites.remove(me.playerName);
|
||||
FPlayer.save();
|
||||
}
|
||||
|
||||
|
58
src/com/bukkit/mcteam/factions/commands/FCommandKick.java
Normal file
58
src/com/bukkit/mcteam/factions/commands/FCommandKick.java
Normal file
@ -0,0 +1,58 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
|
||||
public class FCommandKick extends FBaseCommand {
|
||||
|
||||
public FCommandKick() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
requiredParameters.add("player name");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Kick a player from the faction";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
String playerName = parameters.get(0);
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if (you.getFaction() != myFaction) {
|
||||
sendMessage(you.getNameAndRelevant(me)+Conf.colorSystem+" is not a member of "+myFaction.getTag(me));
|
||||
return;
|
||||
}
|
||||
|
||||
if (me == you) {
|
||||
sendMessage("You cannot kick yourself.");
|
||||
sendMessage("You might want to "+Conf.colorCommand+Conf.aliasBase.get(0)+" "+Conf.aliasLeave.get(0));
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.role.value >= me.role.value) { // TODO add more informative messages.
|
||||
sendMessage("Your rank is too low to kick this player.");
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.invites.remove(you.playerName);
|
||||
you.resetFactionData();
|
||||
FPlayer.save();
|
||||
Faction.save();
|
||||
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" kicked "+you.getNameAndRelevant(myFaction)+Conf.colorSystem+" from the faction! :O");
|
||||
you.sendMessage(me.getNameAndRelevant(you)+Conf.colorSystem+" kicked you from "+myFaction.getTag(you)+Conf.colorSystem+"! :O");
|
||||
}
|
||||
|
||||
}
|
@ -7,7 +7,7 @@ import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
|
||||
public class FCommandLeave extends FCommand {
|
||||
public class FCommandLeave extends FBaseCommand {
|
||||
|
||||
public FCommandLeave() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
@ -17,13 +17,11 @@ public class FCommandLeave extends FCommand {
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpNameAndParams = "leave";
|
||||
helpDescription = "Leave your faction";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! me.hasFaction()) {
|
||||
sendMessage("You are not member of any faction.");
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
89
src/com/bukkit/mcteam/factions/commands/FCommandList.java
Normal file
89
src/com/bukkit/mcteam/factions/commands/FCommandList.java
Normal file
@ -0,0 +1,89 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.util.TextUtil;
|
||||
|
||||
public class FCommandList extends FBaseCommand {
|
||||
|
||||
public FCommandList() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
optionalParameters.add("page");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Show a list of the factions";
|
||||
}
|
||||
|
||||
// TODO put the 0 faction at the highest position
|
||||
public void perform() {
|
||||
ArrayList<Faction> FactionList = new ArrayList<Faction>(Faction.getAll());
|
||||
|
||||
int page = 1;
|
||||
if (parameters.size() > 0) {
|
||||
try {
|
||||
page = Integer.parseInt(parameters.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
// wasn't an integer
|
||||
}
|
||||
}
|
||||
page -= 1;
|
||||
|
||||
// Sort by total followers first
|
||||
Collections.sort(FactionList, new Comparator<Faction>(){
|
||||
@Override
|
||||
public int compare(Faction f1, Faction f2) {
|
||||
if (f1.id == 0)
|
||||
return 1;
|
||||
else if (f2.id == 0)
|
||||
return -1;
|
||||
else if (f1.getFPlayers().size() < f2.getFPlayers().size())
|
||||
return 1;
|
||||
else if (f1.getFPlayers().size() > f2.getFPlayers().size())
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Then sort by how many members are online now
|
||||
Collections.sort(FactionList, new Comparator<Faction>(){
|
||||
@Override
|
||||
public int compare(Faction f1, Faction f2) {
|
||||
if (f1.getFPlayersWhereOnline(true).size() < f2.getFPlayersWhereOnline(true).size())
|
||||
return 1;
|
||||
else if (f1.getFPlayersWhereOnline(true).size() > f2.getFPlayersWhereOnline(true).size())
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
int maxPage = (int)Math.floor((double)FactionList.size() / 9D);
|
||||
if (page < 0 || page > maxPage) {
|
||||
sendMessage("The faction list is only " + (maxPage+1) + " page(s) long");
|
||||
return;
|
||||
}
|
||||
|
||||
String header = "Faction List";
|
||||
if (maxPage > 1) header += " (page " + (page+1) + " of " + (maxPage+1) + ")";
|
||||
sendMessage(TextUtil.titleize(header));
|
||||
|
||||
int maxPos = (page+1) * 9;
|
||||
if (maxPos > FactionList.size()) maxPos = FactionList.size();
|
||||
for (int pos = page * 9; pos < maxPos; pos++) {
|
||||
Faction faction = FactionList.get(pos);
|
||||
if (faction.id == 0) {
|
||||
sendMessage(faction.getTag(me)+Conf.colorSystem+" "+faction.getFPlayersWhereOnline(true).size() + " online");
|
||||
} else {
|
||||
sendMessage(faction.getTag(me)+Conf.colorSystem+" "+faction.getFPlayersWhereOnline(true).size()+"/"+faction.getFPlayers().size()+" online, "+faction.getLandRounded()+"/"+faction.getPowerRounded()+"/"+faction.getPowerMaxRounded());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
47
src/com/bukkit/mcteam/factions/commands/FCommandMap.java
Normal file
47
src/com/bukkit/mcteam/factions/commands/FCommandMap.java
Normal file
@ -0,0 +1,47 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Board;
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FLocation;
|
||||
|
||||
public class FCommandMap extends FBaseCommand {
|
||||
|
||||
public FCommandMap() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
optionalParameters.add("on|off");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Show territory map, set optional auto update";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if (parameters.size() > 0) {
|
||||
String mapAutoUpdating = parameters.get(0);
|
||||
if (Conf.aliasTrue.contains(mapAutoUpdating.toLowerCase())) {
|
||||
// Turn on
|
||||
me.setMapAutoUpdating(true);
|
||||
sendMessage("Map auto update ENABLED.");
|
||||
|
||||
// And show the map once
|
||||
showMap();
|
||||
} else {
|
||||
// Turn off
|
||||
me.setMapAutoUpdating(false);
|
||||
sendMessage("Map auto update DISABLED.");
|
||||
}
|
||||
} else {
|
||||
showMap();
|
||||
}
|
||||
}
|
||||
|
||||
public void showMap() {
|
||||
sendMessage(Board.getMap(me.getFaction(), new FLocation(me), me.getPlayer().getLocation().getYaw()));
|
||||
}
|
||||
|
||||
}
|
63
src/com/bukkit/mcteam/factions/commands/FCommandMod.java
Normal file
63
src/com/bukkit/mcteam/factions/commands/FCommandMod.java
Normal file
@ -0,0 +1,63 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
|
||||
public class FCommandMod extends FBaseCommand {
|
||||
|
||||
public FCommandMod() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
requiredParameters.add("player name");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Give or revoke moderator rights";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.ADMIN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if (you.getFaction() != myFaction) {
|
||||
sendMessage(you.getNameAndRelevant(me)+Conf.colorSystem+" is not a member in your faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (you == me) {
|
||||
sendMessage("The target player musn't be yourself.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.role == Role.MODERATOR) {
|
||||
// Revoke
|
||||
you.role = Role.NORMAL;
|
||||
myFaction.sendMessage(you.getNameAndRelevant(myFaction)+Conf.colorSystem+" is no longer moderator in your faction.");
|
||||
} else {
|
||||
// Give
|
||||
you.role = Role.MODERATOR;
|
||||
myFaction.sendMessage(you.getNameAndRelevant(myFaction)+Conf.colorSystem+" was promoted to moderator in your faction.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
46
src/com/bukkit/mcteam/factions/commands/FCommandOpen.java
Normal file
46
src/com/bukkit/mcteam/factions/commands/FCommandOpen.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
|
||||
public class FCommandOpen extends FBaseCommand {
|
||||
|
||||
public FCommandOpen() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Switch if invitation is required to join";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
myFaction.setOpen( ! me.getFaction().getOpen());
|
||||
|
||||
String open = myFaction.getOpen() ? "open" : "closed";
|
||||
|
||||
// Inform
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed the faction to "+open);
|
||||
for (Faction faction : Faction.getAll()) {
|
||||
if (faction.id == me.factionId) {
|
||||
continue;
|
||||
}
|
||||
faction.sendMessage(Conf.colorSystem+"The faction "+myFaction.getTag(faction)+Conf.colorSystem+" is now "+open);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import com.bukkit.mcteam.factions.struct.Relation;
|
||||
|
||||
public class FCommandRelationAlly extends FRelationCommand {
|
||||
|
||||
public void perform() {
|
||||
relation(Relation.ALLY, parameters.get(0));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import com.bukkit.mcteam.factions.struct.Relation;
|
||||
|
||||
public class FCommandRelationEnemy extends FRelationCommand {
|
||||
|
||||
public void perform() {
|
||||
relation(Relation.ENEMY, parameters.get(0));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import com.bukkit.mcteam.factions.struct.Relation;
|
||||
|
||||
public class FCommandRelationNeutral extends FRelationCommand {
|
||||
|
||||
public void perform() {
|
||||
relation(Relation.NEUTRAL, parameters.get(0));
|
||||
}
|
||||
|
||||
}
|
117
src/com/bukkit/mcteam/factions/commands/FCommandShow.java
Normal file
117
src/com/bukkit/mcteam/factions/commands/FCommandShow.java
Normal file
@ -0,0 +1,117 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Relation;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
import com.bukkit.mcteam.factions.util.TextUtil;
|
||||
|
||||
public class FCommandShow extends FBaseCommand {
|
||||
|
||||
public FCommandShow() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
optionalParameters.add("faction tag");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Show faction information";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
Faction faction;
|
||||
if (parameters.size() > 0) {
|
||||
faction = findFaction(parameters.get(0), true);
|
||||
} else {
|
||||
faction = me.getFaction();
|
||||
}
|
||||
|
||||
Collection<FPlayer> admins = faction.getFPlayersWhereRole(Role.ADMIN);
|
||||
Collection<FPlayer> mods = faction.getFPlayersWhereRole(Role.MODERATOR);
|
||||
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Role.NORMAL);
|
||||
|
||||
sendMessage(TextUtil.titleize(faction.getTag(me)));
|
||||
sendMessage(Conf.colorChrome+"Description: "+Conf.colorSystem+faction.getDescription());
|
||||
if (faction.id == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(faction.getOpen()) {
|
||||
sendMessage(Conf.colorChrome+"Joining: "+Conf.colorSystem+"no invitation is needed");
|
||||
} else {
|
||||
sendMessage(Conf.colorChrome+"Joining: "+Conf.colorSystem+"invitation is required");
|
||||
}
|
||||
sendMessage(Conf.colorChrome+"Land / Power / Maxpower: "+Conf.colorSystem+ faction.getLandRounded()+" / "+faction.getPowerRounded()+" / "+faction.getPowerMaxRounded());
|
||||
|
||||
String listpart;
|
||||
|
||||
// List relation
|
||||
String allyList = Conf.colorChrome+"Allies: ";
|
||||
String enemyList = Conf.colorChrome+"Enemies: ";
|
||||
for (Faction otherFaction : Faction.getAll()) {
|
||||
if (otherFaction == faction) {
|
||||
continue;
|
||||
}
|
||||
listpart = otherFaction.getTag(me)+Conf.colorSystem+", ";
|
||||
if (otherFaction.getRelation(faction) == Relation.ALLY) {
|
||||
allyList += listpart;
|
||||
} else if (otherFaction.getRelation(faction) == Relation.ENEMY) {
|
||||
enemyList += listpart;
|
||||
}
|
||||
}
|
||||
if (allyList.endsWith(", ")) {
|
||||
allyList = allyList.substring(0, allyList.length()-2);
|
||||
}
|
||||
if (enemyList.endsWith(", ")) {
|
||||
enemyList = enemyList.substring(0, enemyList.length()-2);
|
||||
}
|
||||
|
||||
sendMessage(allyList);
|
||||
sendMessage(enemyList);
|
||||
|
||||
// List the members...
|
||||
String onlineList = Conf.colorChrome+"Members online: ";
|
||||
String offlineList = Conf.colorChrome+"Members offline: ";
|
||||
for (FPlayer follower : admins) {
|
||||
listpart = follower.getNameAndTitle(me)+Conf.colorSystem+", ";
|
||||
if (follower.isOnline()) {
|
||||
onlineList += listpart;
|
||||
} else {
|
||||
offlineList += listpart;
|
||||
}
|
||||
}
|
||||
for (FPlayer follower : mods) {
|
||||
listpart = follower.getNameAndTitle(me)+Conf.colorSystem+", ";
|
||||
if (follower.isOnline()) {
|
||||
onlineList += listpart;
|
||||
} else {
|
||||
offlineList += listpart;
|
||||
}
|
||||
}
|
||||
for (FPlayer follower : normals) {
|
||||
listpart = follower.getNameAndTitle(me)+Conf.colorSystem+", ";
|
||||
if (follower.isOnline()) {
|
||||
onlineList += listpart;
|
||||
} else {
|
||||
offlineList += listpart;
|
||||
}
|
||||
}
|
||||
|
||||
if (onlineList.endsWith(", ")) {
|
||||
onlineList = onlineList.substring(0, onlineList.length()-2);
|
||||
}
|
||||
if (offlineList.endsWith(", ")) {
|
||||
offlineList = offlineList.substring(0, offlineList.length()-2);
|
||||
}
|
||||
|
||||
sendMessage(onlineList);
|
||||
sendMessage(offlineList);
|
||||
}
|
||||
|
||||
}
|
63
src/com/bukkit/mcteam/factions/commands/FCommandTag.java
Normal file
63
src/com/bukkit/mcteam/factions/commands/FCommandTag.java
Normal file
@ -0,0 +1,63 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
import com.bukkit.mcteam.factions.util.TextUtil;
|
||||
|
||||
public class FCommandTag extends FBaseCommand {
|
||||
|
||||
public FCommandTag() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
requiredParameters.add("faction tag");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Change the faction tag";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String tag = parameters.get(0);
|
||||
|
||||
// TODO does not first test cover selfcase?
|
||||
if (Faction.isTagTaken(tag) && ! TextUtil.getComparisonString(tag).equals(me.getFaction().getComparisonTag())) {
|
||||
sendMessage("That tag is already taken");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
errors.addAll(Faction.validateTag(tag));
|
||||
if (errors.size() > 0) {
|
||||
sendMessage(errors);
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
String oldtag = myFaction.getTag();
|
||||
myFaction.setTag(tag);
|
||||
|
||||
// Inform
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed your faction tag to "+Conf.colorMember+myFaction.getTag());
|
||||
for (Faction faction : Faction.getAll()) {
|
||||
if (faction.id == me.factionId) {
|
||||
continue;
|
||||
}
|
||||
faction.sendMessage(Conf.colorSystem+"The faction "+me.getRelationColor(faction)+oldtag+Conf.colorSystem+" chainged their name to "+myFaction.getTag(faction));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
50
src/com/bukkit/mcteam/factions/commands/FCommandTitle.java
Normal file
50
src/com/bukkit/mcteam/factions/commands/FCommandTitle.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FPlayer;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.util.TextUtil;
|
||||
|
||||
public class FCommandTitle extends FBaseCommand {
|
||||
|
||||
public FCommandTitle() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
requiredParameters.add("player name");
|
||||
optionalParameters.add("title");
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Set or remove a players title";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
parameters.remove(0);
|
||||
String title = TextUtil.implode(parameters);
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! canIAdministerYou(me, you)) {
|
||||
return;
|
||||
}
|
||||
|
||||
you.setTitle(title);
|
||||
|
||||
// Inform
|
||||
Faction myFaction = me.getFaction();
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed a title: "+you.getNameAndRelevant(myFaction));
|
||||
}
|
||||
|
||||
}
|
47
src/com/bukkit/mcteam/factions/commands/FCommandUnclaim.java
Normal file
47
src/com/bukkit/mcteam/factions/commands/FCommandUnclaim.java
Normal file
@ -0,0 +1,47 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Board;
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.FLocation;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
|
||||
public class FCommandUnclaim extends FBaseCommand {
|
||||
|
||||
public FCommandUnclaim() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
|
||||
helpDescription = "Unclaim the land where you are standing";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
FLocation flocation = new FLocation(me);
|
||||
Faction otherFaction = Board.getFactionAt(flocation);
|
||||
|
||||
if ( myFaction != otherFaction) {
|
||||
sendMessage("You don't own this land.");
|
||||
return;
|
||||
}
|
||||
|
||||
Board.removeAt(flocation);
|
||||
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" unclaimed some land.");
|
||||
}
|
||||
|
||||
}
|
24
src/com/bukkit/mcteam/factions/commands/FCommandVersion.java
Normal file
24
src/com/bukkit/mcteam/factions/commands/FCommandVersion.java
Normal file
@ -0,0 +1,24 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.bukkit.mcteam.factions.Factions;
|
||||
|
||||
public class FCommandVersion extends FBaseCommand {
|
||||
|
||||
public FCommandVersion() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = false;
|
||||
|
||||
helpDescription = "Which version are you using?";
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
sendMessage("You are running "+Factions.instance.getDescription().getFullName());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.bukkit.mcteam.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.bukkit.mcteam.factions.Conf;
|
||||
import com.bukkit.mcteam.factions.Faction;
|
||||
import com.bukkit.mcteam.factions.struct.Relation;
|
||||
import com.bukkit.mcteam.factions.struct.Role;
|
||||
|
||||
public class FRelationCommand extends FBaseCommand {
|
||||
|
||||
public FRelationCommand() {
|
||||
requiredParameters = new ArrayList<String>();
|
||||
optionalParameters = new ArrayList<String>();
|
||||
requiredParameters.add("faction tag");
|
||||
helpDescription = "Declare your factions relation wish to another faction";
|
||||
permissions = "";
|
||||
|
||||
senderMustBePlayer = true;
|
||||
}
|
||||
|
||||
public void relation(Relation whishedRelation, String otherFactionName) {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
Faction otherFaction = findFaction(otherFactionName, false);
|
||||
if (otherFaction == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (otherFaction.id == 0) {
|
||||
sendMessage("Nope! You can't :) The default faction is not a real faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (otherFaction == myFaction) {
|
||||
sendMessage("Nope! You can't declare a relation to yourself :)");
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.setRelationWish(otherFaction, whishedRelation);
|
||||
Relation currentRelation = myFaction.getRelation(otherFaction);
|
||||
ChatColor currentRelationColor = currentRelation.getColor();
|
||||
if (whishedRelation == currentRelation) {
|
||||
otherFaction.sendMessage(Conf.colorSystem+"Your faction is now "+currentRelationColor+whishedRelation.toString()+Conf.colorSystem+" to "+currentRelationColor+myFaction.getTag());
|
||||
myFaction.sendMessage(Conf.colorSystem+"Your faction is now "+currentRelationColor+whishedRelation.toString()+Conf.colorSystem+" to "+currentRelationColor+otherFaction.getTag());
|
||||
} else {
|
||||
otherFaction.sendMessage(currentRelationColor+myFaction.getTag()+Conf.colorSystem+ " wishes to be your "+whishedRelation.getColor()+whishedRelation.toString());
|
||||
otherFaction.sendMessage(Conf.colorSystem+"Type "+Conf.colorCommand+Conf.aliasBase.get(0)+" "+whishedRelation+" "+myFaction.getTag()+Conf.colorSystem+" to accept.");
|
||||
myFaction.sendMessage(currentRelationColor+otherFaction.getTag()+Conf.colorSystem+ " were informed that you wish to be "+whishedRelation.getColor()+whishedRelation);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.bukkit.mcteam.factions;
|
||||
package com.bukkit.mcteam.factions.entities;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -8,7 +8,7 @@ import com.bukkit.mcteam.factions.entities.*;
|
||||
import com.bukkit.mcteam.factions.struct.*;
|
||||
import com.bukkit.mcteam.factions.util.*;
|
||||
|
||||
public class Commands {
|
||||
public class CommandsOld {
|
||||
public static ArrayList<ArrayList<String>> helpPages;
|
||||
|
||||
//----------------------------------------------//
|
||||
@ -18,7 +18,6 @@ public class Commands {
|
||||
static {
|
||||
helpPages = new ArrayList<ArrayList<String>>();
|
||||
ArrayList<String> pageLines;
|
||||
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add(TextUtil.commandHelp(Conf.aliasHelp, "*[page]", "Display a help page"));
|
||||
@ -313,7 +312,7 @@ public class Commands {
|
||||
me.sendMessage(Conf.colorSystem+"Now update your faction description. Use:");
|
||||
me.sendMessage(Conf.colorCommand+Conf.aliasBase.get(0)+" "+Conf.aliasDescription.get(0)+" "+"[description]");
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public static void tag(FPlayer me, String tag) {
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
@ -356,8 +355,7 @@ public class Commands {
|
||||
int page = 1;
|
||||
try {
|
||||
page = Integer.parseInt(inPage);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException e) {
|
||||
// wasn't an integer
|
||||
}
|
||||
page -= 1;
|
||||
@ -833,7 +831,7 @@ public class Commands {
|
||||
|
||||
public static void version(FPlayer me) {
|
||||
me.sendMessage(Conf.colorSystem+"You are running "+Factions.instance.getDescription().getFullName());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.bukkit.mcteam.factions;
|
||||
package com.bukkit.mcteam.factions.entities;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
@ -38,7 +38,7 @@ public class TextUtil {
|
||||
return implode(list, " ");
|
||||
}
|
||||
|
||||
public static String commandHelp(List<String> aliases, String param, String desc) {
|
||||
/*public static String commandHelp(List<String> aliases, String param, String desc) {
|
||||
ArrayList<String> parts = new ArrayList<String>();
|
||||
parts.add(Conf.colorCommand+Conf.aliasBase.get(0));
|
||||
parts.add(TextUtil.implode(aliases, ", "));
|
||||
@ -50,7 +50,7 @@ public class TextUtil {
|
||||
}
|
||||
//Log.debug(TextUtil.implode(parts, " "));
|
||||
return TextUtil.implode(parts, " ");
|
||||
}
|
||||
}*/
|
||||
|
||||
public static String getMaterialName(Material material) {
|
||||
String ret = material.toString();
|
||||
|
Loading…
Reference in New Issue
Block a user