Added Corner Command, Spam Prevent System, Members Upgrade Redone
This commit is contained in:
34
src/main/java/com/massivecraft/factions/util/CornerTask.java
Normal file
34
src/main/java/com/massivecraft/factions/util/CornerTask.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CornerTask extends BukkitRunnable {
|
||||
private FPlayer fPlayer;
|
||||
private List<FLocation> surrounding;
|
||||
private int amount;
|
||||
|
||||
public CornerTask(FPlayer fPlayer, List<FLocation> surrounding) {
|
||||
this.amount = 0;
|
||||
this.fPlayer = fPlayer;
|
||||
this.surrounding = surrounding;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
if (surrounding.isEmpty()) {
|
||||
fPlayer.sendMessage(TL.COMMAND_CORNER_CLAIMED.format(amount));
|
||||
cancel();
|
||||
} else if (fPlayer.isOffline()) {
|
||||
cancel();
|
||||
} else {
|
||||
FLocation fLocation = surrounding.remove(0);
|
||||
if (fPlayer.attemptClaim(fPlayer.getFaction(), fLocation, true)) {
|
||||
++amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user