Added IronGolems settings

This commit is contained in:
Fabrizio La Rosa 2020-07-13 18:57:22 +02:00
parent 03efacf747
commit 432d4b2d8c
5 changed files with 49 additions and 5 deletions

View File

@ -83,6 +83,7 @@ public class PermissionManager {
new ItemDropPermission(), new ItemDropPermission(),
new FishingPermission(plugin), new FishingPermission(plugin),
new CauldronPermission(plugin), new CauldronPermission(plugin),
new IronGolemPermission(plugin),
// Basic // Basic
new MemberPermission(), new MemberPermission(),

View File

@ -0,0 +1,36 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.permission.ListeningPermission;
import com.songoda.skyblock.permission.PermissionHandler;
import com.songoda.skyblock.permission.PermissionType;
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.minecart.ExplosiveMinecart;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.event.vehicle.VehicleDestroyEvent;
public class IronGolemPermission extends ListeningPermission {
private final SkyBlock plugin;
public IronGolemPermission(SkyBlock plugin) {
super("IronGolems", CompatibleMaterial.IRON_BLOCK, PermissionType.ISLAND);
this.plugin = plugin;
}
@PermissionHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof IronGolem) {
event.setCancelled(true);
}
}
}

View File

@ -5,6 +5,7 @@ import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.permission.ListeningPermission; import com.songoda.skyblock.permission.ListeningPermission;
import com.songoda.skyblock.permission.PermissionHandler; import com.songoda.skyblock.permission.PermissionHandler;
import com.songoda.skyblock.permission.PermissionType; import com.songoda.skyblock.permission.PermissionType;
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
@ -64,7 +65,8 @@ public class MobGriefingPermission extends ListeningPermission {
&& (!(event.getDamager() instanceof org.bukkit.entity.Projectile) && (!(event.getDamager() instanceof org.bukkit.entity.Projectile)
|| !(((org.bukkit.entity.Projectile) event.getDamager()).getShooter() instanceof Player)) || !(((org.bukkit.entity.Projectile) event.getDamager()).getShooter() instanceof Player))
&& !(event.getDamager() instanceof TNTPrimed) && !(event.getDamager() instanceof TNTPrimed)
&& !(event.getDamager() instanceof ExplosiveMinecart)) { && !(event.getDamager() instanceof ExplosiveMinecart)
&& !(event.getDamager() instanceof IronGolem)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }

View File

@ -1323,6 +1323,8 @@ Menu:
Displayname: '&aLeaf Decay' Displayname: '&aLeaf Decay'
MobGriefing: MobGriefing:
Displayname: '&aMob Griefing' Displayname: '&aMob Griefing'
IronGolems:
Displayname: '&aIron Golems'
Status: Status:
Enabled: Enabled:
Lore: Lore:
@ -1793,6 +1795,8 @@ Menu:
Displayname: '&aNatural Mob Spawning' Displayname: '&aNatural Mob Spawning'
MobGriefing: MobGriefing:
Displayname: '&aMob Griefing' Displayname: '&aMob Griefing'
IronGolems:
Displayname: '&aIron Golems'
PvP: PvP:
Displayname: '&aPvP' Displayname: '&aPvP'
Explosions: Explosions:

View File

@ -167,6 +167,7 @@ Settings:
Owner: Owner:
NaturalMobSpawning: true NaturalMobSpawning: true
MobGriefing: true MobGriefing: true
IronGolems: true
Explosions: true Explosions: true
FireSpread: true FireSpread: true
LeafDecay: true LeafDecay: true