Skip to content

Commit

Permalink
Added allowPvPOnIslands configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachesMLG committed Sep 23, 2023
1 parent c003a7d commit 6bf07e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ public Configuration() {
public String worldName = "IridiumSkyblock";
public String spawnWorldName = "world";
public String islandTitleTop = "&9%island_name%";
public String islandTitleBottom = "&7%island_description%";
public String islandTitleBottom = "&7%island_description%";
public String paster = "worldedit";


public boolean obsidianBucket = true;
public boolean removeIslandBlocksOnDelete = false;
public boolean allowPvPOnIslands = false;
public int distance = 151;
public int netherUnlockLevel = 10;
public int pasterDelayInTick = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class EntityDamageListener implements Listener {

@EventHandler(ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) {
if (!IridiumSkyblock.getInstance().getConfiguration().allowPvPOnIslands) return;
Optional<Island> island = IridiumSkyblock.getInstance().getIslandManager().getTeamViaLocation(event.getEntity().getLocation());
if (!island.isPresent()) return;

Expand All @@ -33,6 +34,7 @@ public void onEntityDamage(EntityDamageEvent event) {

@EventHandler(ignoreCancelled = true)
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (!IridiumSkyblock.getInstance().getConfiguration().allowPvPOnIslands) return;
if (event.getEntity().equals(event.getDamager())) return;

Optional<Island> island = IridiumSkyblock.getInstance().getIslandManager().getTeamViaLocation(event.getEntity().getLocation());
Expand Down

0 comments on commit 6bf07e5

Please sign in to comment.