Fixed compatibility issue with Jobs.

This commit is contained in:
Brianna 2021-02-22 10:17:18 -06:00
parent 5f6aaa291c
commit 64dbf4665c
3 changed files with 8 additions and 17 deletions

View File

@ -126,11 +126,6 @@
<artifactId>Lootables</artifactId> <artifactId>Lootables</artifactId>
<version>1.0.8</version> <version>1.0.8</version>
</dependency> </dependency>
<dependency>
<groupId>com.gamingmesh</groupId>
<artifactId>jobs</artifactId>
<version>4.10.3</version>
</dependency>
<dependency> <dependency>
<groupId>com.bgsoftware</groupId> <groupId>com.bgsoftware</groupId>
<artifactId>wildstacker</artifactId> <artifactId>wildstacker</artifactId>

View File

@ -192,9 +192,9 @@ public class UltimateStacker extends SongodaPlugin {
pluginManager.registerEvents(new ClearLagListeners(this), this); pluginManager.registerEvents(new ClearLagListeners(this), this);
// Register Hooks // Register Hooks
if (pluginManager.isPluginEnabled("Jobs")) { if (pluginManager.isPluginEnabled("Jobs"))
stackerHooks.add(new JobsHook()); stackerHooks.add(new JobsHook());
}
HologramManager.load(this); HologramManager.load(this);
// Database stuff, go! // Database stuff, go!

View File

@ -1,30 +1,26 @@
package com.songoda.ultimatestacker.hook.hooks; package com.songoda.ultimatestacker.hook.hooks;
import com.gamingmesh.jobs.Jobs; import com.songoda.core.hooks.jobs.JobsPlayerHandler;
import com.gamingmesh.jobs.actions.EntityActionInfo;
import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.songoda.ultimatestacker.hook.StackerHook; import com.songoda.ultimatestacker.hook.StackerHook;
import com.songoda.ultimatestacker.stackable.entity.EntityStack; import com.songoda.ultimatestacker.stackable.entity.EntityStack;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class JobsHook implements StackerHook { public class JobsHook implements StackerHook {
@Override @Override
public void applyExperience(Player player, EntityStack entityStack) { public void applyExperience(Player player, EntityStack entityStack) {
if (player.getGameMode().equals(GameMode.CREATIVE)) if (player.getGameMode().equals(GameMode.CREATIVE) || entityStack.getHostEntity() == null)
return; return;
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); JobsPlayerHandler jPlayer = com.songoda.core.hooks.JobsHook.getPlayer(player);
if (jPlayer == null) if (jPlayer == null)
return; return;
for (int i = 1; i < entityStack.getAmount(); i++) { for (int i = 1; i < entityStack.getAmount(); i++) {
Entity entity = entityStack.getHostEntity(); LivingEntity entity = entityStack.getHostEntity();
EntityActionInfo eInfo = new EntityActionInfo(entity, ActionType.KILL); jPlayer.killEntity(entity);
Jobs.action(jPlayer, eInfo, entity);
} }
} }
} }