mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-08 11:41:28 +01:00
Merge branch 'development'
This commit is contained in:
commit
10dcccd781
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>UltimateKits</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>2.6.8</version>
|
||||
<version>2.6.9</version>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>UltimateKits-${project.version}</finalName>
|
||||
|
@ -146,6 +146,7 @@ public class UltimateKits extends SongodaPlugin {
|
||||
PluginManager pluginManager = getServer().getPluginManager();
|
||||
guiManager.init();
|
||||
pluginManager.registerEvents(new BlockListeners(this), this);
|
||||
pluginManager.registerEvents(new ChunkListeners(this), this);
|
||||
pluginManager.registerEvents(new ChatListeners(this), this);
|
||||
pluginManager.registerEvents(new EntityListeners(this), this);
|
||||
pluginManager.registerEvents(new InteractListeners(this, guiManager), this);
|
||||
|
@ -245,7 +245,7 @@ public class KitEditorGui extends DoubleGui {
|
||||
|
||||
int index = 0;
|
||||
while (index < msg.length()) {
|
||||
lore.add(ChatColor.GREEN + "/" + msg.substring(index, Math.min(index + 30, msg.length())));
|
||||
lore.add(ChatColor.GREEN + (index == 0 ? "/" : "") + msg.substring(index, Math.min(index + 30, msg.length())));
|
||||
index += 30;
|
||||
}
|
||||
meta.setLore(lore);
|
||||
|
@ -67,9 +67,9 @@ public class DisplayItemHandler {
|
||||
|
||||
|
||||
NBTItem nbtItem = NmsManager.getNbt().of(i.getItemStack());
|
||||
int inum = nbtItem.has("num") ? nbtItem.getNBTObject("num").asInt() + 1 : 1;
|
||||
int inum = nbtItem.has("num") ? nbtItem.getNBTObject("num").asInt() + 1 : 0;
|
||||
|
||||
if (inum > list.size()) inum = 1;
|
||||
if (inum >= list.size()) inum = 0;
|
||||
|
||||
ItemStack is = list.get(inum - 1);
|
||||
if (kitBlockData.isItemOverride()) {
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.songoda.ultimatekits.listeners;
|
||||
|
||||
import com.songoda.ultimatekits.UltimateKits;
|
||||
import com.songoda.ultimatekits.key.Key;
|
||||
import com.songoda.ultimatekits.kit.Kit;
|
||||
import com.songoda.ultimatekits.kit.KitBlockData;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by songoda on 2/24/2017.
|
||||
*/
|
||||
public class ChunkListeners implements Listener {
|
||||
|
||||
private final UltimateKits instance;
|
||||
|
||||
public ChunkListeners(UltimateKits instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
instance.getKitManager().getKitLocations().values().stream()
|
||||
.filter(l -> l.getLocation().getWorld() == event.getWorld()
|
||||
&& l.getLocation().getBlockX() >> 4 == event.getChunk().getX()
|
||||
&& l.getLocation().getBlockZ() >> 4 == event.getChunk().getZ())
|
||||
.forEach(instance::updateHologram);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user