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 FishingPermission(plugin),
new CauldronPermission(plugin),
new IronGolemPermission(plugin),
// Basic
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.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;
@ -64,7 +65,8 @@ public class MobGriefingPermission extends ListeningPermission {
&& (!(event.getDamager() instanceof org.bukkit.entity.Projectile)
|| !(((org.bukkit.entity.Projectile) event.getDamager()).getShooter() instanceof Player))
&& !(event.getDamager() instanceof TNTPrimed)
&& !(event.getDamager() instanceof ExplosiveMinecart)) {
&& !(event.getDamager() instanceof ExplosiveMinecart)
&& !(event.getDamager() instanceof IronGolem)) {
event.setCancelled(true);
}
}

View File

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

View File

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