Fixed /givepet not working in PvP worlds.
This commit is contained in:
parent
db10863616
commit
31aa352648
|
|
@ -921,7 +921,7 @@ class PlayerEventHandler implements Listener
|
||||||
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||||
|
|
||||||
//if entity is tameable and has an owner, apply special rules
|
//if entity is tameable and has an owner, apply special rules
|
||||||
if(entity instanceof Tameable && !GriefPrevention.instance.config_pvp_enabledWorlds.contains(entity.getLocation().getWorld()))
|
if(entity instanceof Tameable)
|
||||||
{
|
{
|
||||||
Tameable tameable = (Tameable)entity;
|
Tameable tameable = (Tameable)entity;
|
||||||
if(tameable.isTamed() && tameable.getOwner() != null)
|
if(tameable.isTamed() && tameable.getOwner() != null)
|
||||||
|
|
@ -943,16 +943,19 @@ class PlayerEventHandler implements Listener
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//otherwise disallow
|
if(!GriefPrevention.instance.config_pvp_enabledWorlds.contains(entity.getLocation().getWorld()))
|
||||||
OfflinePlayer owner = GriefPrevention.instance.getServer().getOfflinePlayer(ownerID);
|
{
|
||||||
String ownerName = owner.getName();
|
//otherwise disallow
|
||||||
if(ownerName == null) ownerName = "someone";
|
OfflinePlayer owner = GriefPrevention.instance.getServer().getOfflinePlayer(ownerID);
|
||||||
String message = GriefPrevention.instance.dataStore.getMessage(Messages.NotYourPet, ownerName);
|
String ownerName = owner.getName();
|
||||||
if(player.hasPermission("griefprevention.ignoreclaims"))
|
if(ownerName == null) ownerName = "someone";
|
||||||
message += " " + GriefPrevention.instance.dataStore.getMessage(Messages.IgnoreClaimsAdvertisement);
|
String message = GriefPrevention.instance.dataStore.getMessage(Messages.NotYourPet, ownerName);
|
||||||
GriefPrevention.sendMessage(player, TextMode.Err, message);
|
if(player.hasPermission("griefprevention.ignoreclaims"))
|
||||||
event.setCancelled(true);
|
message += " " + GriefPrevention.instance.dataStore.getMessage(Messages.IgnoreClaimsAdvertisement);
|
||||||
return;
|
GriefPrevention.sendMessage(player, TextMode.Err, message);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user