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>
<version>1.0.8</version>
</dependency>
<dependency>
<groupId>com.gamingmesh</groupId>
<artifactId>jobs</artifactId>
<version>4.10.3</version>
</dependency>
<dependency>
<groupId>com.bgsoftware</groupId>
<artifactId>wildstacker</artifactId>

View File

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

View File

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