Merge branch '1.6.x' into permsfix
This commit is contained in:
@@ -34,7 +34,7 @@ public class CmdAdmin extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
FPlayer fyou = this.argAsBestFPlayerMatch(0);
|
||||
if (fyou == null) {
|
||||
if (fyou == null || fyou.getFaction().isWarZone() || fyou.getFaction().isWilderness() || fyou.getFaction().isSafeZone()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ public class CmdAdmin extends FCommand {
|
||||
|
||||
// if target player is currently admin, demote and replace him
|
||||
if (fyou == admin) {
|
||||
targetFaction.promoteNewLeader();
|
||||
msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(fme, true));
|
||||
fyou.msg(TL.COMMAND_ADMIN_DEMOTED, senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fyou, true));
|
||||
return;
|
||||
targetFaction.promoteNewLeader();
|
||||
msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(fme, true));
|
||||
fyou.msg(TL.COMMAND_ADMIN_DEMOTED, senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fyou, true));
|
||||
return;
|
||||
}
|
||||
|
||||
// promote target player, and demote existing admin if one exists
|
||||
|
||||
@@ -44,10 +44,54 @@ public class CmdFly extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
|
||||
for (String name : flyMap.keySet()) {
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
if (!player.isFlying()) {
|
||||
continue;
|
||||
}
|
||||
if (!SavageFactions.plugin.mc17) {
|
||||
if (player.getGameMode() == GameMode.SPECTATOR) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (FPlayers.getInstance().getByPlayer(player).isVanished()) {
|
||||
// Actually, vanished players (such as admins) should not display particles to prevent others from knowing their vanished assistance for moderation.
|
||||
// But we can keep it as a config.
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enable-While-Vanished")) {
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (SavageFactions.plugin.useNonPacketParticles) {
|
||||
// 1.9+ based servers will use the built in particleAPI instead of packet based.
|
||||
// any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working.
|
||||
// So setting the amount to 0 spawns 1 in the precise location
|
||||
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, -0.35, 0), 0);
|
||||
} else {
|
||||
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16);
|
||||
}
|
||||
|
||||
}
|
||||
if (flyMap.keySet().size() == 0) {
|
||||
Bukkit.getScheduler().cancelTask(id);
|
||||
id = -1;
|
||||
}
|
||||
}, 10L, 3L);
|
||||
}
|
||||
|
||||
public static void startFlyCheck() {
|
||||
flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> { //threw the exception for now, until I recode fly :( Cringe.
|
||||
checkTaskState();
|
||||
if (flyMap.keySet().size() != 0) {
|
||||
for (String name : flyMap.keySet()) {
|
||||
if (name == null) {
|
||||
continue;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null) {
|
||||
continue;
|
||||
@@ -55,88 +99,38 @@ public class CmdFly extends FCommand {
|
||||
if (!player.isFlying()) {
|
||||
continue;
|
||||
}
|
||||
if (!SavageFactions.plugin.mc17) {
|
||||
if (player.getGameMode() == GameMode.SPECTATOR) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (FPlayers.getInstance().getByPlayer(player).isVanished()) {
|
||||
// Actually, vanished players (such as admins) should not display particles to prevent others from knowing their vanished assistance for moderation.
|
||||
// But we can keep it as a config.
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enable-While-Vanished")) {
|
||||
return;
|
||||
}
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
if (fPlayer == null) {
|
||||
continue;
|
||||
}
|
||||
if (SavageFactions.plugin.useNonPacketParticles) {
|
||||
// 1.9+ based servers will use the built in particleAPI instead of packet based.
|
||||
// any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working.
|
||||
// So setting the amount to 0 spawns 1 in the precise location
|
||||
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, -0.35, 0), 0);
|
||||
} else {
|
||||
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16);
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
if (flyMap.keySet().size() == 0) {
|
||||
Bukkit.getScheduler().cancelTask(id);
|
||||
id = -1;
|
||||
}
|
||||
}
|
||||
}, 10L, 3L);
|
||||
}
|
||||
|
||||
public static void startFlyCheck() {
|
||||
flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() throws ConcurrentModificationException { //threw the exception for now, until I recode fly :( Cringe.
|
||||
checkTaskState();
|
||||
if (flyMap.keySet().size() != 0) {
|
||||
for (String name : flyMap.keySet()) {
|
||||
if (name == null) {
|
||||
continue;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
if (!player.isFlying()) {
|
||||
continue;
|
||||
}
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
if (fPlayer == null) {
|
||||
continue;
|
||||
}
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
continue;
|
||||
}
|
||||
if (!SavageFactions.plugin.mc17 && player.getGameMode() == GameMode.SPECTATOR) {
|
||||
continue;
|
||||
}
|
||||
Faction myFaction = fPlayer.getFaction();
|
||||
if (myFaction.isWilderness()) {
|
||||
if (!SavageFactions.plugin.mc17 && player.getGameMode() == GameMode.SPECTATOR) {
|
||||
continue;
|
||||
}
|
||||
Faction myFaction = fPlayer.getFaction();
|
||||
if (myFaction.isWilderness()) {
|
||||
fPlayer.setFlying(false);
|
||||
flyMap.remove(name);
|
||||
continue;
|
||||
}
|
||||
if (fPlayer.checkIfNearbyEnemies()) {
|
||||
continue;
|
||||
}
|
||||
FLocation myFloc = new FLocation(player.getLocation());
|
||||
Faction toFac = Board.getInstance().getFactionAt(myFloc);
|
||||
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
||||
if (!checkBypassPerms(fPlayer, player, toFac)) {
|
||||
fPlayer.setFlying(false);
|
||||
flyMap.remove(name);
|
||||
continue;
|
||||
}
|
||||
if (fPlayer.checkIfNearbyEnemies()) {
|
||||
continue;
|
||||
}
|
||||
FLocation myFloc = new FLocation(player.getLocation());
|
||||
Faction toFac = Board.getInstance().getFactionAt(myFloc);
|
||||
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
||||
if (!checkBypassPerms(fPlayer, player, toFac)) {
|
||||
fPlayer.setFlying(false);
|
||||
flyMap.remove(name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}, 20L, 20L);
|
||||
}
|
||||
|
||||
@@ -226,20 +220,17 @@ public class CmdFly extends FCommand {
|
||||
|
||||
if (fme.canFlyAtLocation())
|
||||
|
||||
this.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fme.setFlying(true);
|
||||
flyMap.put(player.getName(), true);
|
||||
if (id == -1) {
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) {
|
||||
startParticles();
|
||||
}
|
||||
}
|
||||
if (flyid == -1) {
|
||||
startFlyCheck();
|
||||
this.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
|
||||
fme.setFlying(true);
|
||||
flyMap.put(player.getName(), true);
|
||||
if (id == -1) {
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) {
|
||||
startParticles();
|
||||
}
|
||||
}
|
||||
if (flyid == -1) {
|
||||
startFlyCheck();
|
||||
}
|
||||
}, this.p.getConfig().getLong("warmups.f-fly", 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,11 @@ import com.massivecraft.factions.zcore.util.TL;
|
||||
public class CmdPaypalSee extends FCommand {
|
||||
public CmdPaypalSee() {
|
||||
aliases.add("seepaypal");
|
||||
aliases.add("getpaypal");
|
||||
|
||||
requiredArgs.add("faction");
|
||||
|
||||
permission = Permission.ADMIN.node;
|
||||
|
||||
disableOnLock = false;
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
@@ -19,28 +21,29 @@ public class CmdPaypalSee extends FCommand {
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
|
||||
fme.msg(TL.GENERIC_DISABLED);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
Faction faction = argAsFaction(0);
|
||||
|
||||
if (faction != null) {
|
||||
if (faction != null)
|
||||
return;
|
||||
|
||||
if (!faction.isWilderness() && !faction.isSafeZone() && !faction.isWarZone()) {
|
||||
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOFACTION.toString(), me.getName());
|
||||
return;
|
||||
}
|
||||
if (faction.getPaypal() != null) {
|
||||
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal());
|
||||
} else {
|
||||
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET.toString(), faction.getTag(), faction.getPaypal());
|
||||
}
|
||||
|
||||
} else {
|
||||
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOFACTION.toString(), me.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_PAYPALSEE_DESCRIPTION;
|
||||
}
|
||||
|
||||
@@ -8,30 +8,31 @@ public class CmdPaypalSet extends FCommand {
|
||||
|
||||
public CmdPaypalSet() {
|
||||
this.aliases.add("setpaypal");
|
||||
this.aliases.add("paypal");
|
||||
this.requiredArgs.add("email");
|
||||
this.permission = Permission.PAYPALSET.node;
|
||||
this.disableOnLock = false;
|
||||
this.senderMustBePlayer = true;
|
||||
this.senderMustBeMember = false;
|
||||
this.senderMustBeModerator = false;
|
||||
this.senderMustBeColeader = true;
|
||||
this.senderMustBeAdmin = false;
|
||||
this.senderMustBeColeader = false;
|
||||
this.senderMustBeAdmin = true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
|
||||
fme.msg(TL.GENERIC_DISABLED);
|
||||
} else {
|
||||
String paypal = argAsString(0);
|
||||
if (paypal != null) {
|
||||
myFaction.paypalSet(paypal);
|
||||
fme.msg(TL.COMMAND_PAYPALSET_SUCCESSFUL, paypal);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
String paypal = this.argAsString(0);
|
||||
if(paypal == null)
|
||||
return;
|
||||
myFaction.paypalSet(paypal);
|
||||
fme.msg(TL.COMMAND_PAYPALSET_SUCCESSFUL, paypal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_PAYPALSET_DESCRIPTION;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user