Added AltsList properly and setup booster and point shop

[+] Pom completely fixed
This commit is contained in:
Driftay 2019-07-11 01:08:35 -04:00
parent 179981f935
commit 5f2cc89e2d
9 changed files with 43 additions and 232 deletions

55
pom.xml
View File

@ -77,61 +77,6 @@
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version> <version>3.0.1</version>
</plugin> </plugin>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<options>
<!-- General Settings -->
<option>-dontoptimize</option>
<option>-ignorewarnings</option>
<!-- All removes disabled -->
<!--option>-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod</option-->
<!-- Boiled down to required options -->
<option>-keepattributes Signature,*Annotation*</option>
<!-- Keep the main class for the Plugin Loader to find -->
<option>-keep public class com.massivecraft.factions.SaberFactions</option>
<!-- These three are required for the json serializer, breaks if removed, oh and also for the config :) -->
<option>-keep class com.massivecraft.factions.Conf { *; }</option>
<option>-keepclassmembers enum * { *; }</option>
<option>-keep class com.massivecraft.factions.zcore.persist.json.** { *; }</option>
<option>-keep class com.massivecraft.factions.cmd.FCommand { *; }</option>
<option>-keep class com.massivecraft.factions.zcore.MCommand { *; }</option>
<option>-keep class com.massivecraft.factions.event.** { *; }</option>
<option>-keep class com.massivecraft.factions.iface.** { *; }</option>
<option>-keep class com.massivecraft.factions.Board { *; }</option>
<option>-keep class com.massivecraft.factions.Faction { *; }</option>
<option>-keep class com.massivecraft.factions.Factions { *; }</option>
<option>-keep class com.massivecraft.factions.FLocation { *; }</option>
<option>-keep class com.massivecraft.factions.zcore.fperms.PermissableAction { *; }</option>
<option>-keep class com.massivecraft.factions.struct.Relation { *; }</option>
<option>-keep class com.massivecraft.factions.util.ClipPlaceholderAPIManager { *; }</option>
<option>-keep class com.massivecraft.factions.FPlayer { *; }</option>
<option>-keep class com.massivecraft.factions.FPlayers { *; }</option>
<!-- keep the lib -->
<option>-keep class net.amoebaman.** { *; }</option>
<option>-dontnote org.bukkit.**</option>
<option>-dontnote net.amoebaman.**</option>
<option>-dontnote net.minecraft.server.**</option>
</options>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
</libs>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -24,6 +24,11 @@ public interface Faction extends EconomyParticipator {
boolean altInvited(FPlayer fplayer); boolean altInvited(FPlayer fplayer);
void deinviteAlt(FPlayer alt);
void deinviteAllAlts();
void altInvite(FPlayer fplayer); void altInvite(FPlayer fplayer);
boolean addAltPlayer(FPlayer fplayer); boolean addAltPlayer(FPlayer fplayer);

View File

@ -249,11 +249,11 @@ public class FCmdRoot extends FCommand {
} }
if(SaberFactions.plugin.getConfig().getBoolean("f-points.Enabled")){ if(SaberFactions.plugin.getConfig().getBoolean("f-points.Enabled")){
this.addSubCommand(cmdPoints); this.addSubCommand(this.cmdPoints);
} }
if(SaberFactions.plugin.getConfig().getBoolean("f-alts.Enabled")){ if(SaberFactions.plugin.getConfig().getBoolean("f-alts.Enabled")){
this.addSubCommand(cmdAlts); this.addSubCommand(this.cmdAlts);
} }
if (SaberFactions.plugin.getConfig().getBoolean("f-grace.Enabled")) { if (SaberFactions.plugin.getConfig().getBoolean("f-grace.Enabled")) {

View File

@ -8,7 +8,6 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdAlts extends FCommand { public class CmdAlts extends FCommand {
public CmdKickAlt cmdKickAlt = new CmdKickAlt();
public CmdInviteAlt cmdInviteAlt = new CmdInviteAlt(); public CmdInviteAlt cmdInviteAlt = new CmdInviteAlt();
public CmdAltsList cmdAltsList = new CmdAltsList(); public CmdAltsList cmdAltsList = new CmdAltsList();
@ -24,13 +23,12 @@ public class CmdAlts extends FCommand {
this.disableOnSpam = false; this.disableOnSpam = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeModerator = false;
senderMustBeAdmin = false; senderMustBeAdmin = false;
this.addSubCommand(this.cmdInviteAlt); this.addSubCommand(this.cmdInviteAlt);
this.addSubCommand(this.cmdKickAlt);
this.addSubCommand(this.cmdAltsList); this.addSubCommand(this.cmdAltsList);
} }

View File

@ -1,13 +1,13 @@
package com.massivecraft.factions.cmd.alts; package com.massivecraft.factions.cmd.alts;
import com.google.common.base.Joiner;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.cmd.FCommand;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import org.apache.commons.lang.time.DurationFormatUtils;
import org.bukkit.ChatColor;
import java.util.ArrayList; import java.util.stream.Collectors;
public class CmdAltsList extends FCommand { public class CmdAltsList extends FCommand {
@ -15,13 +15,16 @@ public class CmdAltsList extends FCommand {
public CmdAltsList() { public CmdAltsList() {
super(); super();
this.aliases.add("list"); this.aliases.add("list");
this.aliases.add("l");
this.optionalArgs.put("faction", "yours");
this.permission = Permission.LIST.node; this.permission = Permission.LIST.node;
this.disableOnLock = false; this.disableOnLock = false;
this.disableOnSpam = false; this.disableOnSpam = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeModerator = false;
senderMustBeAdmin = false; senderMustBeAdmin = false;
@ -29,22 +32,27 @@ public class CmdAltsList extends FCommand {
@Override @Override
public void perform() { public void perform() {
Faction faction = myFaction;
if(argIsSet(0)){
faction = argAsFaction(0);
}
if(faction == null)
return;
ArrayList<String> ret = new ArrayList<>(); if(faction != myFaction && !fme.isAdminBypassing()){
for (FPlayer fp : myFaction.getAltPlayers()) {
if(myFaction.getAltPlayers().isEmpty()){
fme.sendMessage(TL.COMMAND_ALTS_LIST_NOALTS.toString());
return; return;
} }
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX; if(faction.getAltPlayers().size() == 0){
String last = fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized); msg(TL.COMMAND_ALTS_LIST_NOALTS, faction.getTag());
String power = ChatColor.YELLOW + String.valueOf(fp.getPowerRounded()) + " / " + fp.getPowerMaxRounded() + ChatColor.RESET; return;
ret.add(String.format(TL.COMMAND_ALTS_LIST_FORMAT.toString(), ChatColor.GOLD + fp.getName() + ChatColor.RESET, power, last).trim());
} }
fme.sendMessage(ret);
msg("<a>There are " + faction.getAltPlayers().size() + " alts in " + faction.getTag() + ":");
msg("<i>" + Joiner.on(", ").join(faction.getAltPlayers().stream().map(FPlayer::getName).collect(Collectors.toList())));
} }
@Override @Override
public TL getUsageTranslation() { public TL getUsageTranslation() {
return TL.COMMAND_ALTS_LIST_DESCRIPTION; return TL.COMMAND_ALTS_LIST_DESCRIPTION;

View File

@ -1,148 +0,0 @@
package com.massivecraft.factions.cmd.alts;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.SaberFactions;
import com.massivecraft.factions.cmd.FCommand;
import com.massivecraft.factions.event.FPlayerLeaveEvent;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
public class CmdKickAlt extends FCommand {
public CmdKickAlt(){
super();
this.aliases.add("kick");
this.requiredArgs.add("player name");
// this.optionalArgs.put("", "");
this.permission = Permission.KICK.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (!SaberFactions.plugin.getConfig().getBoolean("f-alts.Enabled", false)) {
fme.msg(TL.GENERIC_DISABLED);
return;
}
FPlayer toKick = this.argIsSet(0) ? this.argAsBestFPlayerMatch(0) : null;
if (toKick == null) {
msg(TL.COMMAND_ALTKICK_NOTMEMBER);
return;
}
if (fme == toKick) {
msg(TL.COMMAND_KICK_SELF);
msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdLeave.getUseageTemplate(false));
return;
}
Faction toKickFaction = toKick.getFaction();
if (toKickFaction.isWilderness()) {
sender.sendMessage(TL.COMMAND_KICK_NONE.toString());
return;
}
// players with admin-level "disband" permission can bypass these
// requirements
if (!Permission.KICK_ANY.has(sender)) {
Access access = myFaction.getAccess(fme, PermissableAction.KICK);
if (access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.MODERATOR))) {
fme.msg(TL.GENERIC_NOPERMISSION, "kick");
return;
}
if (toKickFaction != myFaction) {
msg(TL.COMMAND_KICK_NOTMEMBER, toKick.describeTo(fme, true), myFaction.describeTo(fme));
return;
}
if (!toKick.isAlt()) {
msg(TL.COMMAND_ALTKICK_NOTALT);
return;
}
// Check for Access before we check for Role.
if (access != Access.ALLOW && toKick.getRole().value >= fme.getRole().value) {
msg(TL.COMMAND_KICK_INSUFFICIENTRANK);
return;
}
if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) {
msg(TL.COMMAND_KICK_NEGATIVEPOWER);
return;
}
}
Access access = myFaction.getAccess(fme, PermissableAction.KICK);
// This statement allows us to check if they've specifically denied it,
// or default to
// the old setting of allowing moderators to kick
if (access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.MODERATOR))) {
fme.msg(TL.GENERIC_NOPERMISSION, "kick");
return;
}
// if economy is enabled, they're not on the bypass list, and this
// command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) {
return;
}
// trigger the leave event (cancellable) [reason:kicked]
FPlayerLeaveEvent event = new FPlayerLeaveEvent(toKick, toKick.getFaction(), FPlayerLeaveEvent.PlayerLeaveReason.KICKED);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
// then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString(), TL.COMMAND_KICK_FORKICK.toString())) {
return;
}
toKickFaction.msg(TL.COMMAND_KICK_FACTION, fme.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true));
toKick.msg(TL.COMMAND_KICK_KICKED, fme.describeTo(toKick, true), toKickFaction.describeTo(toKick));
if (toKickFaction != myFaction) {
fme.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(fme), toKickFaction.describeTo(fme));
}
if (Conf.logFactionKick) {
SaberFactions.plugin.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: "
+ toKickFaction.getTag());
}
// SHOULD NOT BE POSSIBLE BUT KEPT INCASE
if (toKick.getRole() == Role.LEADER) {
toKickFaction.promoteNewLeader();
}
toKickFaction.removeAltPlayer(toKick);
toKickFaction.deinvite(toKick);
toKick.resetFactionData();
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_ALTKICK_DESCRIPTION;
}
}

View File

@ -35,7 +35,6 @@ public class CmdPoints extends FCommand {
fme.msg(TL.GENERIC_DISABLED); fme.msg(TL.GENERIC_DISABLED);
return; return;
} }
this.commandChain.add(this); this.commandChain.add(this);
SaberFactions.plugin.cmdAutoHelp.execute(this.sender, this.args, this.commandChain); SaberFactions.plugin.cmdAutoHelp.execute(this.sender, this.args, this.commandChain);
} }

View File

@ -225,12 +225,16 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
this.player = fp; this.player = fp;
} }
public Set<String> getInvites() { public Set<String> getInvites() { return invites; }
return invites;
public Set<String> getAltInvites() { return altinvites; }
public void deinviteAlt(FPlayer fplayer) {
altinvites.remove(fplayer.getId());
} }
public Set<String> getAltInvites() { public void deinviteAllAlts() {
return altinvites; altinvites.clear();
} }
public String getId() { public String getId() {

View File

@ -138,7 +138,6 @@ public enum TL {
COMMAND_AHOME_TARGET("You were sent to your f home."), COMMAND_AHOME_TARGET("You were sent to your f home."),
COMMAND_ANNOUNCE_DESCRIPTION("Announce a message to players in faction."), COMMAND_ANNOUNCE_DESCRIPTION("Announce a message to players in faction."),
COMMAND_ALTS_DESCRIPTION("Faction Alts Commands"), COMMAND_ALTS_DESCRIPTION("Faction Alts Commands"),
COMMAND_STRIKE_DESCRIPTION("Faction Strike Commands"), COMMAND_STRIKE_DESCRIPTION("Faction Strike Commands"),
@ -163,7 +162,7 @@ public enum TL {
COMMAND_ALTKICK_NOTALT("&c&l[!] &7Player is not an alt."), COMMAND_ALTKICK_NOTALT("&c&l[!] &7Player is not an alt."),
COMMAND_ALTKICK_NOTMEMBER("&c&l[!] &7This player is not a member of your faction."), COMMAND_ALTKICK_NOTMEMBER("&c&l[!] &7This player is not a member of your faction."),
COMMAND_ALTS_LIST_NOALTS("&c&l[!] &7You have no alts in your faction!"), COMMAND_ALTS_LIST_NOALTS("&c&l[!] &7$1%s does not have any alts in their faction!"),
COMMAND_AUTOHELP_HELPFOR("Help for command \""), COMMAND_AUTOHELP_HELPFOR("Help for command \""),
COMMAND_BAN_DESCRIPTION("Ban players from joining your Faction."), COMMAND_BAN_DESCRIPTION("Ban players from joining your Faction."),
@ -726,6 +725,7 @@ public enum TL {
COMMAND_SHOWINVITES_DESCRIPTION("Show pending faction invites"), COMMAND_SHOWINVITES_DESCRIPTION("Show pending faction invites"),
COMMAND_ALTS_LIST_FORMAT("%1$s Power: %2$s Last Seen: %3$s"), COMMAND_ALTS_LIST_FORMAT("%1$s Power: %2$s Last Seen: %3$s"),
COMMAND_ALTS_DEINVITE_DESCRIPTION("Base command for revoking alt invitations"),
COMMAND_STATUS_FORMAT("%1$s Power: %2$s Last Seen: %3$s"), COMMAND_STATUS_FORMAT("%1$s Power: %2$s Last Seen: %3$s"),
COMMAND_STATUS_ONLINE("Online"), COMMAND_STATUS_ONLINE("Online"),