Merge branch 'development'

This commit is contained in:
Brianna 2020-09-08 10:27:48 -05:00
commit 10dcccd781
5 changed files with 42 additions and 4 deletions

View File

@ -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>

View File

@ -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);

View File

@ -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);

View File

@ -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()) {

View File

@ -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);
}
}