Removed Shop (In Dev)
This commit is contained in:
parent
11fb6dcd7d
commit
2c1f74a2cf
@ -10,8 +10,6 @@ import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.integration.Worldguard;
|
||||
import com.massivecraft.factions.integration.dynmap.EngineDynmap;
|
||||
import com.massivecraft.factions.listeners.*;
|
||||
import com.massivecraft.factions.shop.handlers.BoosterHandler;
|
||||
import com.massivecraft.factions.shop.handlers.PotionHandler;
|
||||
import com.massivecraft.factions.struct.ChatMode;
|
||||
import com.massivecraft.factions.util.*;
|
||||
import com.massivecraft.factions.util.Particles.ReflectionUtils;
|
||||
@ -28,7 +26,6 @@ import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -232,9 +229,6 @@ public class SaberFactions extends MPlugin {
|
||||
log("Skript addon registered!");
|
||||
}
|
||||
|
||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new BoosterHandler(), 100L, 100L);
|
||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new PotionHandler(this), 100L, 100L);
|
||||
|
||||
getServer().getPluginManager().registerEvents(factionsPlayerListener = new FactionsPlayerListener(), this);
|
||||
|
||||
// Register Event Handlers
|
||||
|
@ -1,26 +0,0 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.shop.ShopGUI;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdShop extends FCommand {
|
||||
|
||||
|
||||
public CmdShop() {
|
||||
this.aliases.add("shop");
|
||||
this.senderMustBePlayer = true;
|
||||
this.senderMustBeColeader = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
ShopGUI shopGUI = new ShopGUI(p, fme);
|
||||
shopGUI.build();
|
||||
fme.getPlayer().openInventory(shopGUI.getInventory());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_SHOP_DESCRIPTION;
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package com.massivecraft.factions.shop;
|
||||
|
||||
public class Pair<K, V> {
|
||||
private K key;
|
||||
private V value;
|
||||
|
||||
public Pair(K key, V value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public K getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public V getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
@ -1,148 +0,0 @@
|
||||
package com.massivecraft.factions.shop;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.SaberFactions;
|
||||
import com.massivecraft.factions.util.FactionGUI;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ShopBoosterGUI implements FactionGUI {
|
||||
private SaberFactions plugin;
|
||||
private FPlayer fPlayer;
|
||||
private Inventory inventory;
|
||||
private Map<Integer, String> items;
|
||||
|
||||
public ShopBoosterGUI(SaberFactions plugin, FPlayer fPlayer) {
|
||||
this.items = new HashMap<>();
|
||||
this.plugin = plugin;
|
||||
this.fPlayer = fPlayer;
|
||||
this.inventory = plugin.getServer().createInventory(this, plugin.getConfig().getInt("BoosterGUISize") * 9, TL.SHOP_BOOSTER_TITLE.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(int slot, ClickType action) {
|
||||
if (slot == plugin.getConfig().getInt("BackButtonSlot")) {
|
||||
ShopGUI shopGUI = new ShopGUI(plugin, fPlayer);
|
||||
shopGUI.build();
|
||||
fPlayer.getPlayer().openInventory(shopGUI.getInventory());
|
||||
return;
|
||||
}
|
||||
String booster = items.getOrDefault(slot, null);
|
||||
if (booster == null) {
|
||||
return;
|
||||
}
|
||||
ConfigurationSection section = plugin.getConfig().getConfigurationSection("BoosterGUI").getConfigurationSection(booster);
|
||||
if (section == null) {
|
||||
return;
|
||||
}
|
||||
Faction faction = fPlayer.getFaction();
|
||||
int max = plugin.getConfig().getInt("MaxActiveBooster");
|
||||
if (faction.getActivePotions().size() >= max) {
|
||||
fPlayer.msg(TL.SHOP_GUI_BOOSTER_MAX_REACHED, max);
|
||||
return;
|
||||
}
|
||||
if (fPlayer.getFaction().getBoosters().containsKey(booster)) {
|
||||
fPlayer.msg(TL.SHOP_GUI_BOOSTER_ACTIVE_ALREADY_ACTIVE);
|
||||
return;
|
||||
}
|
||||
int cost = section.getInt("PointCost");
|
||||
if (faction.getPoints() < cost) {
|
||||
fPlayer.msg(TL.SHOP_GUI_BOOSTER_CANNOT_AFFORD, cost);
|
||||
return;
|
||||
}
|
||||
String name = ChatColor.translateAlternateColorCodes('&', section.getString("Name"));
|
||||
faction.setPoints(faction.getPoints() - cost);
|
||||
String string;
|
||||
String type = string = section.getString("Type");
|
||||
switch (string) {
|
||||
case "COMMAND": {
|
||||
for (String command : section.getStringList("Commands")) {
|
||||
this.plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command.replace("%faction%", fPlayer.getFaction().getTag()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "COMMAND_ONLINE": {
|
||||
for (FPlayer player : fPlayer.getFaction().getFPlayersWhereOnline(true)) {
|
||||
for (String command2 : section.getStringList("Commands")) {
|
||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command2.replace("%faction%", fPlayer.getFaction().getTag()).replace("%player_name%", player.getName()).replace("%player_uuid%", player.getPlayer().getUniqueId().toString()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "COMMAND_OFFLINE": {
|
||||
for (FPlayer player : fPlayer.getFaction().getFPlayers()) {
|
||||
for (String command2 : section.getStringList("Commands")) {
|
||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command2.replace("%faction%", fPlayer.getFaction().getTag()).replace("%player_name%", player.getName()).replace("%player_uuid%", this.plugin.getServer().getOfflinePlayer(player.getName()).getUniqueId().toString()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
fPlayer.getFaction().getBoosters().put(booster, System.currentTimeMillis() + section.getInt("CooldownMinutes") * 60000);
|
||||
faction.msg(TL.SHOP_POTION_GUI_ACTIVATED, fPlayer.getNameAndTitle(), name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase());
|
||||
build();
|
||||
fPlayer.getPlayer().openInventory(inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build() {
|
||||
ConfigurationSection configurationSection = plugin.getConfig().getConfigurationSection("BoosterGUI");
|
||||
if (configurationSection == null) {
|
||||
return;
|
||||
}
|
||||
Set<String> boosters = fPlayer.getFaction().getBoosters().keySet();
|
||||
for (String key : configurationSection.getKeys(false)) {
|
||||
ConfigurationSection section = configurationSection.getConfigurationSection(key);
|
||||
int slot = Integer.valueOf(key);
|
||||
int price = section.getInt("PointCost");
|
||||
ItemStack itemStack = new ItemStack(Material.valueOf(section.getString("Material")));
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', section.getString("Name")));
|
||||
List<String> loreLines = new ArrayList<>();
|
||||
for (String line : section.getStringList("Lore")) {
|
||||
loreLines.add(ChatColor.translateAlternateColorCodes('&', line.replace("%price%", String.valueOf(price))));
|
||||
}
|
||||
if (boosters.contains(key)) {
|
||||
itemMeta.addEnchant(Enchantment.SILK_TOUCH, 1, true);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
loreLines.add(TL.SHOP_GUI_BOOSTER_ACTIVE_LORE_LINE.toString());
|
||||
}
|
||||
itemMeta.setLore(loreLines);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
inventory.setItem(slot, itemStack);
|
||||
items.put(slot, key);
|
||||
}
|
||||
ConfigurationSection backSection = plugin.getConfig().getConfigurationSection("BackButton");
|
||||
if (backSection != null) {
|
||||
ItemStack backStack = new ItemStack(Material.valueOf(backSection.getString("Material")));
|
||||
ItemMeta backMeta = backStack.getItemMeta();
|
||||
backMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', backSection.getString("Name")));
|
||||
backStack.setItemMeta(backMeta);
|
||||
inventory.setItem(plugin.getConfig().getInt("BackButtonSlot"), backStack);
|
||||
}
|
||||
ConfigurationSection pointsSection = plugin.getConfig().getConfigurationSection("PointsItem");
|
||||
if (pointsSection != null) {
|
||||
ItemStack pointsStack = new ItemStack(Material.valueOf(pointsSection.getString("Material")));
|
||||
ItemMeta pointsMeta = pointsStack.getItemMeta();
|
||||
pointsMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', pointsSection.getString("Name").replace("%points%", String.valueOf(fPlayer.getFaction().getPoints()))));
|
||||
pointsStack.setItemMeta(pointsMeta);
|
||||
inventory.setItem(plugin.getConfig().getInt("PointsSlot"), pointsStack);
|
||||
}
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
package com.massivecraft.factions.shop;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.SaberFactions;
|
||||
import com.massivecraft.factions.util.FactionGUI;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class ShopGUI implements FactionGUI {
|
||||
private SaberFactions plugin;
|
||||
private FPlayer fPlayer;
|
||||
private Inventory inventory;
|
||||
|
||||
public ShopGUI(SaberFactions plugin, FPlayer fPlayer) {
|
||||
this.plugin = plugin;
|
||||
this.fPlayer = fPlayer;
|
||||
this.inventory = plugin.getServer().createInventory(this, 27, plugin.color(plugin.getConfig().getString("F-Shop.Gui-Title")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(int slot, ClickType action) {
|
||||
if (slot == 11) {
|
||||
ShopPotionGUI potionGUI = new ShopPotionGUI(plugin, fPlayer);
|
||||
potionGUI.build();
|
||||
fPlayer.getPlayer().openInventory(potionGUI.getInventory());
|
||||
} else if (slot == 15) {
|
||||
ShopBoosterGUI boosterGUI = new ShopBoosterGUI(plugin, fPlayer);
|
||||
boosterGUI.build();
|
||||
fPlayer.getPlayer().openInventory(boosterGUI.getInventory());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build() {
|
||||
ItemStack potionStack = new ItemStack(Material.POTION);
|
||||
PotionMeta potionMeta = (PotionMeta) potionStack.getItemMeta();
|
||||
potionMeta.addCustomEffect(new PotionEffect(PotionEffectType.REGENERATION, 1, 1), true);
|
||||
potionMeta.setDisplayName(ChatColor.LIGHT_PURPLE + ChatColor.BOLD.toString() + "Potion Shop");
|
||||
potionStack.setItemMeta(potionMeta);
|
||||
inventory.setItem(11, potionStack);
|
||||
ItemStack boosterStack = new ItemStack(Material.GOLDEN_APPLE);
|
||||
ItemMeta boosterMeta = boosterStack.getItemMeta();
|
||||
boosterMeta.setDisplayName(ChatColor.WHITE + ChatColor.BOLD.toString() + "Booster Shop");
|
||||
boosterStack.setItemMeta(boosterMeta);
|
||||
inventory.setItem(15, boosterStack);
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
package com.massivecraft.factions.shop;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.SaberFactions;
|
||||
import com.massivecraft.factions.util.FactionGUI;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ShopPotionGUI implements FactionGUI {
|
||||
private SaberFactions plugin;
|
||||
private FPlayer fPlayer;
|
||||
private Inventory inventory;
|
||||
private Map<Integer, Pair<String, Pair<Integer, Integer>>> items;
|
||||
|
||||
public ShopPotionGUI(SaberFactions plugin, FPlayer fPlayer) {
|
||||
this.items = new HashMap<>();
|
||||
this.plugin = plugin;
|
||||
this.fPlayer = fPlayer;
|
||||
this.inventory = plugin.getServer().createInventory(this, plugin.getConfig().getInt("PotionGUISize") * 9, TL.SHOP_POTION_TITLE.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(int slot, ClickType action) {
|
||||
if (slot == plugin.getConfig().getInt("BackButtonSlot")) {
|
||||
ShopGUI shopGUI = new ShopGUI(plugin, fPlayer);
|
||||
shopGUI.build();
|
||||
fPlayer.getPlayer().openInventory(shopGUI.getInventory());
|
||||
return;
|
||||
}
|
||||
Pair<String, Pair<Integer, Integer>> pair = items.getOrDefault(slot, null);
|
||||
if (pair == null) {
|
||||
return;
|
||||
}
|
||||
Faction faction = fPlayer.getFaction();
|
||||
int max = plugin.getConfig().getInt("MaxActivePotions");
|
||||
if (faction.getActivePotions().size() >= max) {
|
||||
fPlayer.msg(TL.SHOP_POTION_GUI_MAX_REACHED, max);
|
||||
return;
|
||||
}
|
||||
if (faction.getActivePotions().containsKey(pair.getKey())) {
|
||||
fPlayer.msg(TL.SHOP_POTION_GUI_POTION_TYPE_ALREADY_ACTIVE);
|
||||
return;
|
||||
}
|
||||
if (faction.getPoints() < pair.getValue().getValue()) {
|
||||
fPlayer.msg(TL.SHOP_POTION_GUI_INSUFFICIENT_POINTS, pair.getValue().getValue());
|
||||
return;
|
||||
}
|
||||
faction.setPoints(faction.getPoints() - pair.getValue().getValue());
|
||||
faction.getActivePotions().put(pair.getKey(), new Pair<>(pair.getValue().getKey(), System.currentTimeMillis() + plugin.getConfig().getInt("PotionsLastHours") * 3600000));
|
||||
faction.msg(TL.SHOP_POTION_GUI_ACTIVATED, fPlayer.getNameAndTitle(), pair.getKey().substring(0, 1).toUpperCase() + pair.getKey().substring(1).toLowerCase().replace('_', ' '));
|
||||
build();
|
||||
fPlayer.getPlayer().openInventory(inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build() {
|
||||
ConfigurationSection configurationSection = plugin.getConfig().getConfigurationSection("PotionShop");
|
||||
if (configurationSection == null) {
|
||||
return;
|
||||
}
|
||||
Set<String> activePotions = fPlayer.getFaction().getActivePotions().keySet();
|
||||
for (String key : configurationSection.getKeys(false)) {
|
||||
ConfigurationSection section = configurationSection.getConfigurationSection(key);
|
||||
int slot = Integer.valueOf(key);
|
||||
int level = section.getInt("Level");
|
||||
int price = section.getInt("PointCost");
|
||||
String potionType = section.getString("PotionType");
|
||||
ItemStack itemStack = new ItemStack(Material.POTION);
|
||||
PotionMeta itemMeta = (PotionMeta) itemStack.getItemMeta();
|
||||
itemMeta.addCustomEffect(new PotionEffect(PotionEffectType.getByName(potionType), 1, level), true);
|
||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', section.getString("Name")));
|
||||
List<String> loreLines = new ArrayList<>();
|
||||
for (String line : section.getStringList("Lore")) {
|
||||
loreLines.add(ChatColor.translateAlternateColorCodes('&', line).replace("%price%", String.valueOf(price)));
|
||||
}
|
||||
if (activePotions.contains(potionType)) {
|
||||
itemMeta.addEnchant(Enchantment.SILK_TOUCH, 1, true);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
loreLines.add(TL.SHOP_POTION_GUI_ACTIVATED_LORE_LINE.toString());
|
||||
}
|
||||
itemMeta.setLore(loreLines);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
inventory.setItem(slot, itemStack);
|
||||
items.put(slot, new Pair<>(potionType, new Pair<>(level, price)));
|
||||
}
|
||||
ConfigurationSection backSection = plugin.getConfig().getConfigurationSection("BackButton");
|
||||
if (backSection != null) {
|
||||
ItemStack backStack = new ItemStack(Material.valueOf(backSection.getString("Material")));
|
||||
ItemMeta backMeta = backStack.getItemMeta();
|
||||
backMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', backSection.getString("Name")));
|
||||
backStack.setItemMeta(backMeta);
|
||||
inventory.setItem(plugin.getConfig().getInt("BackButtonSlot"), backStack);
|
||||
}
|
||||
ConfigurationSection pointsSection = plugin.getConfig().getConfigurationSection("PointsItem");
|
||||
if (pointsSection != null) {
|
||||
ItemStack pointsStack = new ItemStack(Material.valueOf(pointsSection.getString("Material")));
|
||||
ItemMeta pointsMeta = pointsStack.getItemMeta();
|
||||
pointsMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', pointsSection.getString("Name").replace("%points%", String.valueOf(fPlayer.getFaction().getPoints()))));
|
||||
pointsStack.setItemMeta(pointsMeta);
|
||||
inventory.setItem(plugin.getConfig().getInt("PointsSlot"), pointsStack);
|
||||
}
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.massivecraft.factions.shop.handlers;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BoosterHandler implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
for (final Faction faction : Factions.getInstance().getAllFactions()) {
|
||||
final List<String> remove = new ArrayList<>();
|
||||
for (final Map.Entry<String, Long> entry : faction.getBoosters().entrySet()) {
|
||||
if (entry.getValue() < currentTime) {
|
||||
remove.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
remove.forEach((r) ->{
|
||||
Long n = faction.getBoosters().remove(r);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package com.massivecraft.factions.shop.handlers;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.SaberFactions;
|
||||
import com.massivecraft.factions.shop.Pair;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PotionHandler implements Runnable {
|
||||
private SaberFactions plugin;
|
||||
|
||||
public PotionHandler(SaberFactions plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
||||
List<String> remove = new ArrayList<String>();
|
||||
for (Map.Entry<String, Pair<Integer, Long>> entry : faction.getActivePotions().entrySet()) {
|
||||
if (entry.getValue().getValue() < currentTime) {
|
||||
remove.add(entry.getKey());
|
||||
} else {
|
||||
PotionEffect potionEffect = new PotionEffect(PotionEffectType.getByName(entry.getKey()), 400, entry.getValue().getKey(), false, false);
|
||||
for (FPlayer fPlayer : faction.getFPlayersWhereOnline(true)) {
|
||||
if (!fPlayer.isInOwnTerritory()) {
|
||||
continue;
|
||||
}
|
||||
this.plugin.getServer().getScheduler().runTask(this.plugin, () -> fPlayer.getPlayer().addPotionEffect(potionEffect, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
remove.forEach(key -> {
|
||||
Pair<Integer, Long> pair = faction.getActivePotions().remove(key);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user