mirror of https://github.com/Maxlego08/zKoth.git
📝 Add koth save for loot
This commit is contained in:
parent
09e5f4ee19
commit
301de953c0
|
@ -127,6 +127,8 @@ public class KothListener extends ListenerAdapter {
|
||||||
itemStacks.removeIf(itemStack -> itemStack == null || itemStack.getType() == Material.AIR);
|
itemStacks.removeIf(itemStack -> itemStack == null || itemStack.getType() == Material.AIR);
|
||||||
koth.setItemStacks(itemStacks);
|
koth.setItemStacks(itemStacks);
|
||||||
message(player, Message.LOOT_CHANGE, "%name%", koth.getName());
|
message(player, Message.LOOT_CHANGE, "%name%", koth.getName());
|
||||||
|
|
||||||
|
manager.saveKoth(koth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,12 +526,6 @@ public class ZKoth extends ZUtils implements Koth {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.displayMessageKothCap.contains(currentRemainingSeconds)) {
|
|
||||||
broadcast(Message.EVENT_TIMER);
|
|
||||||
} else if (enableEverySecondsCapMessage) {
|
|
||||||
broadcast(Message.EVENT_EVERYSECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hasWin()) {
|
if (this.hasWin()) {
|
||||||
|
|
||||||
this.endKoth(task, cuboid, player);
|
this.endKoth(task, cuboid, player);
|
||||||
|
@ -541,6 +535,14 @@ public class ZKoth extends ZUtils implements Koth {
|
||||||
KothCapEvent capEvent = new KothCapEvent(this, player, this.remainingSeconds.get(), this.kothTeam.getFactionTag(player));
|
KothCapEvent capEvent = new KothCapEvent(this, player, this.remainingSeconds.get(), this.kothTeam.getFactionTag(player));
|
||||||
capEvent.callEvent();
|
capEvent.callEvent();
|
||||||
|
|
||||||
|
if (Config.displayMessageKothCap.contains(currentRemainingSeconds)) {
|
||||||
|
broadcast(Message.EVENT_TIMER);
|
||||||
|
} else if (enableEverySecondsCapMessage) {
|
||||||
|
broadcast(Message.EVENT_EVERYSECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.plugin.getKothHologram().update(this);
|
||||||
|
|
||||||
switch (this.kothType) {
|
switch (this.kothType) {
|
||||||
case CAPTURE:
|
case CAPTURE:
|
||||||
default:
|
default:
|
||||||
|
@ -551,8 +553,6 @@ public class ZKoth extends ZUtils implements Koth {
|
||||||
this.playersValues.put(this.currentPlayer.getUniqueId(), this.getValue(this.currentPlayer) + 1);
|
this.playersValues.put(this.currentPlayer.getUniqueId(), this.getValue(this.currentPlayer) + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.plugin.getKothHologram().update(this);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -773,4 +773,9 @@ public class ZKoth extends ZUtils implements Koth {
|
||||||
Collections.shuffle(itemStacks, new Random());
|
Collections.shuffle(itemStacks, new Random());
|
||||||
return itemStacks.stream().limit(this.randomItemStacks).collect(Collectors.toList());
|
return itemStacks.stream().limit(this.randomItemStacks).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRandomItemStack() {
|
||||||
|
return this.randomItemStacks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package fr.maxlego08.koth.api;
|
package fr.maxlego08.koth.api;
|
||||||
|
|
||||||
import fr.maxlego08.koth.KothPlugin;
|
|
||||||
import fr.maxlego08.koth.api.discord.DiscordWebhookConfig;
|
import fr.maxlego08.koth.api.discord.DiscordWebhookConfig;
|
||||||
import fr.maxlego08.koth.api.utils.HologramConfig;
|
import fr.maxlego08.koth.api.utils.HologramConfig;
|
||||||
import fr.maxlego08.koth.api.utils.ScoreboardConfiguration;
|
import fr.maxlego08.koth.api.utils.ScoreboardConfiguration;
|
||||||
|
@ -76,9 +75,12 @@ public interface Koth {
|
||||||
DiscordWebhookConfig getDiscordWebhookConfig();
|
DiscordWebhookConfig getDiscordWebhookConfig();
|
||||||
|
|
||||||
List<ItemStack> getItemStacks();
|
List<ItemStack> getItemStacks();
|
||||||
|
|
||||||
void setItemStacks(List<ItemStack> itemStacks);
|
void setItemStacks(List<ItemStack> itemStacks);
|
||||||
|
|
||||||
KothLootType getLootType();
|
KothLootType getLootType();
|
||||||
|
|
||||||
List<ItemStack> getRandomItemStacks();
|
List<ItemStack> getRandomItemStacks();
|
||||||
|
|
||||||
|
int getRandomItemStack();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,9 +66,10 @@ public class KothLoader extends ZUtils implements Loader<Koth> {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ItemStack> itemStacks = configuration.getStringList("loot.items").stream().map(ItemStackUtils::deserializeItemStack).collect(Collectors.toList());
|
List<ItemStack> itemStacks = configuration.getStringList("loot.items").stream().map(ItemStackUtils::deserializeItemStack).collect(Collectors.toList());
|
||||||
|
int randomItemStacks = configuration.getInt("loot.random", 0);
|
||||||
|
|
||||||
return new ZKoth(this.plugin, fileName, kothType, name, captureSeconds, minLocation, maxLocation, startCommands, endCommands, cooldownScoreboard,
|
return new ZKoth(this.plugin, fileName, kothType, name, captureSeconds, minLocation, maxLocation, startCommands, endCommands, cooldownScoreboard,
|
||||||
startScoreboard, cooldownStart, stopAfterSeconds, enableStartCapMessage, enableLooseCapMessage, enableEverySecondsCapMessage, hologramConfig, itemStacks, kothLootType, discordWebhookConfig);
|
startScoreboard, cooldownStart, stopAfterSeconds, enableStartCapMessage, enableLooseCapMessage, enableEverySecondsCapMessage, hologramConfig, itemStacks, kothLootType, discordWebhookConfig, randomItemStacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -91,6 +92,7 @@ public class KothLoader extends ZUtils implements Loader<Koth> {
|
||||||
hologramConfigLoader.save(koth.getHologramConfig(), configuration, "hologram.");
|
hologramConfigLoader.save(koth.getHologramConfig(), configuration, "hologram.");
|
||||||
|
|
||||||
configuration.set("loot.type", koth.getLootType().name());
|
configuration.set("loot.type", koth.getLootType().name());
|
||||||
|
configuration.set("loot.random", koth.getRandomItemStack());
|
||||||
List<String> items = koth.getItemStacks().stream().map(ItemStackUtils::serializeItemStack).collect(Collectors.toList());
|
List<String> items = koth.getItemStacks().stream().map(ItemStackUtils::serializeItemStack).collect(Collectors.toList());
|
||||||
configuration.set("loot.items", items);
|
configuration.set("loot.items", items);
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ webhook:
|
||||||
|
|
||||||
loot:
|
loot:
|
||||||
# Takes 10 items from the list of items, to put all the items you must put -1
|
# Takes 10 items from the list of items, to put all the items you must put -1
|
||||||
randomItemStacks: 3
|
random: 3
|
||||||
# Available type :
|
# Available type :
|
||||||
# DROP
|
# DROP
|
||||||
# CHEST
|
# CHEST
|
||||||
|
|
Loading…
Reference in New Issue