Item market value indexing added
This commit is contained in:
parent
33e30c1896
commit
10fca98300
28 changed files with 208 additions and 88 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package org.gsdistance.grimmsServer.Events.Listeners;
|
||||
|
||||
import org.gsdistance.grimmsServer.Constructable.Item.ItemLevelHandler;
|
||||
import org.gsdistance.grimmsServer.Constructable.Item.RelicHandler;
|
||||
|
||||
import java.util.Random;
|
||||
|
|
@ -13,6 +14,9 @@ public class PlayerItemDamageEvent {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (ItemLevelHandler.isItemLevelable(event.getItem())){
|
||||
ItemLevelHandler.getLevelHandler(event.getItem(), event.getPlayer()).addXp(event.getDamage());
|
||||
}
|
||||
// Handle rest
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
package org.gsdistance.grimmsServer.Events.Listeners;
|
||||
|
||||
import org.bukkit.boss.KeyedBossBar;
|
||||
import org.gsdistance.grimmsServer.Constructable.Faction;
|
||||
import org.gsdistance.grimmsServer.Constructable.World.ChunkMetadata;
|
||||
import org.gsdistance.grimmsServer.GrimmsServer;
|
||||
import org.gsdistance.grimmsServer.Shared;
|
||||
|
||||
public class PlayerMoveEvent {
|
||||
public static void Event(org.bukkit.event.player.PlayerMoveEvent event) {
|
||||
if (event.getTo() == null) {
|
||||
return; // Do nothing if the destination is null
|
||||
}
|
||||
if (event.getFrom().getChunk().equals(event.getTo().getChunk())) {
|
||||
return; // Do nothing if the player hasn't moved to a new chunk
|
||||
}
|
||||
|
||||
// Remove the player from the previous chunk's boss bar
|
||||
ChunkMetadata fromChunkMetadata = ChunkMetadata.getChunkMetadata(event.getFrom().getChunk());
|
||||
if (fromChunkMetadata != null && fromChunkMetadata.factionUUID != null) {
|
||||
Faction fromFaction = Faction.getFaction(fromChunkMetadata.factionUUID);
|
||||
if (fromFaction != null) {
|
||||
KeyedBossBar fromBossBar = fromFaction.getBossBar();
|
||||
if (fromBossBar != null) {
|
||||
fromBossBar.removePlayer(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the player to the new chunk's boss bar
|
||||
ChunkMetadata toChunkMetadata = ChunkMetadata.getChunkMetadata(event.getTo().getChunk());
|
||||
if (toChunkMetadata != null && toChunkMetadata.factionUUID != null) {
|
||||
Faction toFaction = Faction.getFaction(toChunkMetadata.factionUUID);
|
||||
if (toFaction != null) {
|
||||
KeyedBossBar toBossBar = toFaction.getBossBar();
|
||||
if (toBossBar != null) {
|
||||
toBossBar.addPlayer(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue