Update to newer API.
This commit is contained in:
parent
c4f7d6b756
commit
a73f2b0174
1
pom.xml
1
pom.xml
@ -93,7 +93,6 @@
|
||||
</repository>
|
||||
<repository>
|
||||
<id>mcstats.releases</id>
|
||||
<name>mcstats.org releases</name>
|
||||
<url>http://repo.mcstats.org/content/repositories/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
|
@ -236,9 +236,6 @@ public class CmdConfig extends FCommand {
|
||||
}
|
||||
// save change to disk
|
||||
Conf.save();
|
||||
|
||||
// in case some Spout related setting was changed
|
||||
SpoutFeatures.updateAppearances();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -85,7 +85,5 @@ public class CmdDisband extends FCommand {
|
||||
}
|
||||
|
||||
faction.detach();
|
||||
|
||||
SpoutFeatures.updateAppearances();
|
||||
}
|
||||
}
|
||||
|
@ -75,14 +75,12 @@ public class CmdOwner extends FCommand {
|
||||
// if no player name was passed, and this claim does already have owners set, clear them
|
||||
if (args.isEmpty() && myFaction.doesLocationHaveOwnersSet(flocation)) {
|
||||
myFaction.clearClaimOwnership(flocation);
|
||||
SpoutFeatures.updateOwnerListLoc(flocation);
|
||||
fme.msg("<i>You have cleared ownership for this claimed area.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (myFaction.isPlayerInOwnerList(playerName, flocation)) {
|
||||
myFaction.removePlayerAsOwner(playerName, flocation);
|
||||
SpoutFeatures.updateOwnerListLoc(flocation);
|
||||
fme.msg("<i>You have removed ownership of this claimed land from %s<i>.", playerName);
|
||||
return;
|
||||
}
|
||||
@ -92,7 +90,6 @@ public class CmdOwner extends FCommand {
|
||||
return;
|
||||
|
||||
myFaction.setPlayerAsOwner(playerName, flocation);
|
||||
SpoutFeatures.updateOwnerListLoc(flocation);
|
||||
|
||||
fme.msg("<i>You have added %s<i> to the owner list for this claimed land.", playerName);
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ public class CmdPeaceful extends FCommand {
|
||||
}
|
||||
}
|
||||
|
||||
SpoutFeatures.updateAppearances(faction);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -67,9 +67,6 @@ public class CmdTag extends FCommand {
|
||||
faction.msg("<i>The faction %s<i> changed their name to %s.", fme.getColorTo(faction) + oldtag, myFaction.getTag(faction));
|
||||
}
|
||||
|
||||
if (Conf.spoutFactionTagsOverNames) {
|
||||
SpoutFeatures.updateAppearances(myFaction);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,10 +38,6 @@ public class CmdTitle extends FCommand {
|
||||
|
||||
// Inform
|
||||
myFaction.msg("%s<i> changed a title: %s", fme.describeTo(myFaction, true), you.describeTo(myFaction, true));
|
||||
|
||||
if (Conf.spoutFactionTitlesOverNames) {
|
||||
SpoutFeatures.updateAppearances(me);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ public class CmdUnclaim extends FCommand {
|
||||
if (otherFaction.isSafeZone()) {
|
||||
if (Permission.MANAGE_SAFE_ZONE.has(sender)) {
|
||||
Board.removeAt(flocation);
|
||||
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
|
||||
msg("<i>Safe zone was unclaimed.");
|
||||
|
||||
if (Conf.logLandUnclaims)
|
||||
@ -44,7 +43,6 @@ public class CmdUnclaim extends FCommand {
|
||||
} else if (otherFaction.isWarZone()) {
|
||||
if (Permission.MANAGE_WAR_ZONE.has(sender)) {
|
||||
Board.removeAt(flocation);
|
||||
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
|
||||
msg("<i>War zone was unclaimed.");
|
||||
|
||||
if (Conf.logLandUnclaims)
|
||||
@ -57,7 +55,6 @@ public class CmdUnclaim extends FCommand {
|
||||
|
||||
if (fme.isAdminBypassing()) {
|
||||
Board.removeAt(flocation);
|
||||
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
|
||||
|
||||
otherFaction.msg("%s<i> unclaimed some of your land.", fme.describeTo(otherFaction, true));
|
||||
msg("<i>You unclaimed this land.");
|
||||
@ -97,7 +94,6 @@ public class CmdUnclaim extends FCommand {
|
||||
}
|
||||
|
||||
Board.removeAt(flocation);
|
||||
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
|
||||
myFaction.msg("%s<i> unclaimed some land.", fme.describeTo(myFaction, true));
|
||||
|
||||
if (Conf.logLandUnclaims)
|
||||
|
@ -44,7 +44,6 @@ public class CmdUnclaimall extends FCommand {
|
||||
|
||||
Board.unclaimAll(myFaction.getId());
|
||||
myFaction.msg("%s<i> unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true));
|
||||
SpoutFeatures.updateTerritoryDisplayLoc(null);
|
||||
|
||||
if (Conf.logLandUnclaims)
|
||||
P.p.log(fme.getName() + " unclaimed everything for the faction: " + myFaction.getTag());
|
||||
|
@ -81,7 +81,5 @@ public abstract class FRelationCommand extends FCommand {
|
||||
myFaction.msg("<i>This will have no effect while your faction is peaceful.");
|
||||
}
|
||||
|
||||
SpoutFeatures.updateAppearances(myFaction, them);
|
||||
SpoutFeatures.updateTerritoryDisplayLoc(null);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
@ -219,13 +220,16 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
if (!badjuju) return;
|
||||
|
||||
Entity thrower = event.getPotion().getShooter();
|
||||
ProjectileSource thrower = event.getPotion().getShooter();
|
||||
if (!(thrower instanceof Entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// scan through affected entities to make sure they're all valid targets
|
||||
Iterator<LivingEntity> iter = event.getAffectedEntities().iterator();
|
||||
while (iter.hasNext()) {
|
||||
LivingEntity target = iter.next();
|
||||
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(thrower, target, EntityDamageEvent.DamageCause.CUSTOM, 0);
|
||||
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent((Entity) thrower, target, EntityDamageEvent.DamageCause.CUSTOM, 0);
|
||||
if (!this.canDamagerHurtDamagee(sub, true))
|
||||
event.setIntensity(target, 0.0); // affected entity list doesn't accept modification (so no iter.remove()), but this works
|
||||
sub = null;
|
||||
@ -249,7 +253,8 @@ public class FactionsEntityListener implements Listener {
|
||||
public boolean canDamagerHurtDamagee(EntityDamageByEntityEvent sub, boolean notify) {
|
||||
Entity damager = sub.getDamager();
|
||||
Entity damagee = sub.getEntity();
|
||||
int damage = sub.getDamage();
|
||||
ProjectileSource shooter = null;
|
||||
double damage = sub.getDamage();
|
||||
|
||||
if (!(damagee instanceof Player))
|
||||
return true;
|
||||
@ -263,10 +268,11 @@ public class FactionsEntityListener implements Listener {
|
||||
Faction defLocFaction = Board.getFactionAt(new FLocation(defenderLoc));
|
||||
|
||||
// for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source
|
||||
if (damager instanceof Projectile)
|
||||
damager = ((Projectile) damager).getShooter();
|
||||
if (damager instanceof Projectile) {
|
||||
shooter = ((Projectile) damager).getShooter();
|
||||
}
|
||||
|
||||
if (damager == damagee) // ender pearl usage and other self-inflicted damage
|
||||
if (shooter != null && shooter == damagee) // ender pearl usage and other self-inflicted damage
|
||||
return true;
|
||||
|
||||
// Players can not take attack damage in a SafeZone, or possibly peaceful territory
|
||||
|
@ -38,10 +38,6 @@ public class FactionsPlayerListener implements Listener {
|
||||
|
||||
// Store player's current FLocation and notify them where they are
|
||||
me.setLastStoodAt(new FLocation(event.getPlayer().getLocation()));
|
||||
if (!SpoutFeatures.updateTerritoryDisplay(me))
|
||||
me.sendFactionHereMessage();
|
||||
|
||||
SpoutFeatures.updateAppearancesShortly(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
@ -57,7 +53,6 @@ public class FactionsPlayerListener implements Listener {
|
||||
if (myFaction != null) {
|
||||
myFaction.memberLoggedOff();
|
||||
}
|
||||
SpoutFeatures.playerDisconnect(me);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -91,19 +86,16 @@ public class FactionsPlayerListener implements Listener {
|
||||
me.setLastStoodAt(to);
|
||||
|
||||
// Did we change "host"(faction)?
|
||||
boolean spoutClient = SpoutFeatures.availableFor(player);
|
||||
Faction factionFrom = Board.getFactionAt(from);
|
||||
Faction factionTo = Board.getFactionAt(to);
|
||||
boolean changedFaction = (factionFrom != factionTo);
|
||||
|
||||
if (changedFaction && SpoutFeatures.updateTerritoryDisplay(me))
|
||||
if (changedFaction)
|
||||
changedFaction = false;
|
||||
|
||||
if (me.isMapAutoUpdating()) {
|
||||
me.sendMessage(Board.getMap(me.getFaction(), to, player.getLocation().getYaw()));
|
||||
|
||||
if (spoutClient && Conf.spoutTerritoryOwnersShow)
|
||||
SpoutFeatures.updateOwnerList(me);
|
||||
} else {
|
||||
Faction myFaction = me.getFaction();
|
||||
String ownersTo = myFaction.getOwnerListString(to);
|
||||
@ -116,11 +108,7 @@ public class FactionsPlayerListener implements Listener {
|
||||
&&
|
||||
Conf.ownedMessageOnBorder
|
||||
&&
|
||||
(
|
||||
!spoutClient
|
||||
||
|
||||
!Conf.spoutTerritoryOwnersShow
|
||||
)
|
||||
(!Conf.spoutTerritoryOwnersShow)
|
||||
&&
|
||||
myFaction == factionTo
|
||||
&&
|
||||
@ -128,8 +116,6 @@ public class FactionsPlayerListener implements Listener {
|
||||
) {
|
||||
me.sendMessage(Conf.ownedLandMessage + ownersTo);
|
||||
}
|
||||
} else if (spoutClient && Conf.spoutTerritoryOwnersShow) {
|
||||
SpoutFeatures.updateOwnerList(me);
|
||||
} else if
|
||||
(
|
||||
Conf.ownedAreasEnabled
|
||||
@ -494,8 +480,6 @@ public class FactionsPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
SpoutFeatures.playerDisconnect(badGuy);
|
||||
|
||||
// if player was banned (not just kicked), get rid of their stored info
|
||||
if (Conf.removePlayerDataWhenBanned && event.getReason().equals("Banned by admin.")) {
|
||||
if (badGuy.getRole() == Role.ADMIN)
|
||||
|
@ -19,17 +19,11 @@ public class FactionsServerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
String name = event.getPlugin().getDescription().getName();
|
||||
if (name.equals("Spout")) {
|
||||
SpoutFeatures.setAvailable(false, "");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
Plugin plug = event.getPlugin();
|
||||
String name = plug.getDescription().getName();
|
||||
if (name.equals("Spout")) {
|
||||
SpoutFeatures.setAvailable(true, plug.getDescription().getFullName());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user