mirror of
https://github.com/songoda/UltimateKits.git
synced 2025-02-16 19:31:25 +01:00
Merge branch 'development'
This commit is contained in:
commit
fab88208f3
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.10b</version>
|
||||
<version>2.6.11</version>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>UltimateKits-${project.version}</finalName>
|
||||
|
@ -455,6 +455,12 @@ public class UltimateKits extends SongodaPlugin {
|
||||
public void saveKits(boolean force) {
|
||||
if (!loaded && !force) return;
|
||||
|
||||
// If we're changing the order the file needs to be wiped.
|
||||
if (kitManager.hasOrderChanged()) {
|
||||
kitConfig.clearConfig(true);
|
||||
kitManager.savedOrderChange();
|
||||
}
|
||||
|
||||
// Hot fix for kit file resets.
|
||||
if (kitConfig.contains("Kits"))
|
||||
for (String kitName : kitConfig.getConfigurationSection("Kits").getKeys(false)) {
|
||||
|
@ -19,7 +19,7 @@ public class CommandKey extends AbstractCommand {
|
||||
private final UltimateKits plugin;
|
||||
|
||||
public CommandKey(UltimateKits plugin) {
|
||||
super(CommandType.PLAYER_ONLY, "key");
|
||||
super(CommandType.CONSOLE_OK, "key");
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class CommandKit extends AbstractCommand {
|
||||
private final GuiManager guiManager;
|
||||
|
||||
public CommandKit(UltimateKits plugin, GuiManager guiManager) {
|
||||
super(CommandType.PLAYER_ONLY, "kit");
|
||||
super(CommandType.CONSOLE_OK, "kit");
|
||||
this.plugin = plugin;
|
||||
this.guiManager = guiManager;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -67,7 +68,8 @@ public class DisplayItemHandler {
|
||||
NBTItem nbtItem = NmsManager.getNbt().of(i.getItemStack());
|
||||
int inum = nbtItem.has("num") ? nbtItem.getNBTObject("num").asInt() + 1 : 0;
|
||||
|
||||
if (inum >= list.size()) inum = 0;
|
||||
int size = list.size();
|
||||
if (inum > size || inum <= 0) inum = 1;
|
||||
|
||||
ItemStack is = list.get(inum - 1);
|
||||
if (kitBlockData.isItemOverride()) {
|
||||
@ -77,6 +79,7 @@ public class DisplayItemHandler {
|
||||
is.setAmount(1);
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
meta.setDisplayName(null);
|
||||
meta.setLore(Collections.singletonList("Some lore stuff man."));
|
||||
is.setItemMeta(meta);
|
||||
nbtItem = NmsManager.getNbt().of(is);
|
||||
nbtItem.set("num", inum);
|
||||
|
@ -14,6 +14,7 @@ public final class KitManager {
|
||||
|
||||
private final Map<Location, KitBlockData> kitsAtLocations = new HashMap<>();
|
||||
private final List<Kit> registeredKits = new LinkedList<>();
|
||||
private boolean hasOrderChanged = false;
|
||||
|
||||
public Kit addKit(Kit kit) {
|
||||
if (kit == null) return null;
|
||||
@ -109,6 +110,14 @@ public final class KitManager {
|
||||
|
||||
if (action >= 0 && action < registeredKits.size())
|
||||
Collections.swap(registeredKits, i, action);
|
||||
hasOrderChanged = true;
|
||||
}
|
||||
|
||||
public boolean hasOrderChanged() {
|
||||
return hasOrderChanged;
|
||||
}
|
||||
|
||||
public void savedOrderChange() {
|
||||
hasOrderChanged = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user