Merge branch 'development'

This commit is contained in:
Brianna 2020-06-11 11:14:26 -05:00
commit 4201c14684
5 changed files with 26 additions and 14 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>UltimateKits</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>2.6.5</version>
<version>2.6.6</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>UltimateKits-${project.version}</finalName>
@ -128,7 +128,7 @@
<dependency>
<groupId>com.zrips</groupId>
<artifactId>CMI</artifactId>
<version>8.0.8.1</version>
<version>8.6.26.9</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>

View File

@ -38,17 +38,21 @@ public class Convert {
}
private static void convertKits(Hook hook) {
Set<String> kits = hook.getKits();
for (String kit : kits) {
Kit kitObj = UltimateKits.getInstance().getKitManager().addKit(new Kit(kit));
if (kitObj == null) continue;
for (ItemStack item : hook.getItems(kit)) {
if (item == null || item.getType() == Material.AIR) continue;
kitObj.getContents().add(new KitItem(item));
try {
Set<String> kits = hook.getKits();
for (String kit : kits) {
Kit kitObj = UltimateKits.getInstance().getKitManager().addKit(new Kit(kit));
if (kitObj == null) continue;
for (ItemStack item : hook.getItems(kit)) {
if (item == null || item.getType() == Material.AIR) continue;
kitObj.getContents().add(new KitItem(item));
}
kitObj.setDelay(hook.getDelay(kit));
}
kitObj.setDelay(hook.getDelay(kit));
UltimateKits.getInstance().saveKits(true);
} catch (NoSuchMethodError | NoClassDefFoundError e) {
System.out.println("UltimateKits conversion failed.");
}
UltimateKits.getInstance().saveKits(true);
}
private static boolean isInJsonFormat() {

View File

@ -29,7 +29,7 @@ public class DisplayItemHandler {
}
public void start() {
Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(instance, this::displayItems, 30L, 30L);
Bukkit.getServer().getScheduler().runTaskTimer(instance, this::displayItems, 30L, 30L);
}
private void displayItems() {
@ -48,6 +48,10 @@ public class DisplayItemHandler {
if (list == null) return;
if (list.isEmpty()) return;
if (!location.getWorld().isChunkLoaded((int) location.getX() >> 4, (int) location.getZ() >> 4))
return;
for (Entity e : location.getChunk().getEntities()) {
if (e.getType() != EntityType.DROPPED_ITEM
|| e.getLocation().getX() != location.getX()

View File

@ -308,7 +308,7 @@ public class Kit {
if (innerContents.size() != itemGiveAmount || kitAnimation != KitAnimation.NONE)
Collections.shuffle(innerContents);
for (KitItem item : innerContents) {
for (KitItem item : new ArrayList<>(innerContents)) {
if (itemGiveAmount == 0) break;
double ch = item.getChance() == 0 ? 100 : item.getChance();
double rand = Math.random() * 100;
@ -326,6 +326,8 @@ public class Kit {
|| item.getContent() instanceof KitContentCommand)
continue;
innerContents.remove(item);
if (Settings.AUTO_EQUIP_ARMOR.getBoolean() && ArmorType.equip(player, parseStack)) continue;
Map<Integer, ItemStack> overfilled = player.getInventory().addItem(parseStack);

View File

@ -98,11 +98,13 @@ public class InteractListeners implements Listener {
@EventHandler
public void onCrateClick(PlayerInteractEvent event) {
// Would be better to use NBT to make the item persist over aesthetic changes.
// Yes you really should have used NBT. In fact we have an API for this in SongodaCore...
// Filter physical actions (pressure plates, buttons)
if (event.getAction() == Action.PHYSICAL
|| event.getItem() == null
|| event.getItem().getType() == CompatibleMaterial.AIR.getMaterial())
|| event.getItem().getType() == CompatibleMaterial.AIR.getMaterial()
|| CompatibleMaterial.getMaterial(event.getItem()) != CompatibleMaterial.CHEST)
return;
ItemStack item = event.getItem();