mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-12-31 21:07:47 +01:00
Custom WorldGuard flag.
This commit is contained in:
parent
61e120c3ca
commit
00a4e5e048
@ -12,6 +12,7 @@ import com.songoda.core.database.MySQLConnector;
|
||||
import com.songoda.core.database.SQLiteConnector;
|
||||
import com.songoda.core.gui.GuiManager;
|
||||
import com.songoda.core.hooks.HologramManager;
|
||||
import com.songoda.core.hooks.WorldGuardHook;
|
||||
import com.songoda.core.utils.TextUtils;
|
||||
import com.songoda.ultimatestacker.commands.CommandConvert;
|
||||
import com.songoda.ultimatestacker.commands.CommandGiveSpawner;
|
||||
@ -86,6 +87,9 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
@Override
|
||||
public void onPluginLoad() {
|
||||
INSTANCE = this;
|
||||
|
||||
// Register WorldGuard
|
||||
WorldGuardHook.addHook("mob-stacking", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.songoda.ultimatestacker.tasks;
|
||||
|
||||
import com.songoda.core.hooks.WorldGuardHook;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||
import com.songoda.ultimatestacker.entity.EntityStackManager;
|
||||
@ -147,6 +148,10 @@ public class StackingTask extends BukkitRunnable {
|
||||
// Make sure the entity has not already been processed.
|
||||
if (this.processed.contains(entity.getUniqueId())) continue;
|
||||
|
||||
// Check our WorldGuard flag.
|
||||
if (WorldGuardHook.isEnabled() && !WorldGuardHook.getBooleanFlag(entity.getLocation(), "mob-stacking"))
|
||||
continue;
|
||||
|
||||
// Get this entities friendStack.
|
||||
EntityStack friendStack = stackManager.getStack(entity);
|
||||
|
||||
@ -210,6 +215,10 @@ public class StackingTask extends BukkitRunnable {
|
||||
// If our entity is stacked then skip this entity.
|
||||
if (isStack) return;
|
||||
|
||||
// Check our WorldGuard flag.
|
||||
if (WorldGuardHook.isEnabled() && !WorldGuardHook.getBooleanFlag(livingEntity.getLocation(), "mob-stacking"))
|
||||
return;
|
||||
|
||||
// Remove all stacked entities from our stackable friends.
|
||||
stackableFriends.removeIf(stackManager::isStacked);
|
||||
|
||||
|
@ -2,6 +2,7 @@ name: UltimateStacker
|
||||
description: UltimateStacker
|
||||
version: maven-version-number
|
||||
softdepend: [HolographicDisplays, WorldGuard, EpicSpawners, mcMMO]
|
||||
loadbefore: [WorldGuard]
|
||||
main: com.songoda.ultimatestacker.UltimateStacker
|
||||
author: songoda
|
||||
api-version: 1.13
|
||||
|
Loading…
Reference in New Issue
Block a user