1.0.3b SNAPSHOT HOTFIX
Fix dupe with enabled drop confirm
This commit is contained in:
1 parent
d1dcc34708
commit
71203206d1
9 files changed
+94
-6
No files matched your search
+1
-1
@@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'me.redtea'
|
group = 'me.redtea'
|
||||||
version = '1.0.3a-SNAPSHOT'
|
version = '1.0.3b-SNAPSHOT'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public final class NoDropX extends JavaPlugin {
|
|||||||
noDropCosmeticService.add(textContext.getLoreStrategy());
|
noDropCosmeticService.add(textContext.getLoreStrategy());
|
||||||
noDropCosmeticService.load(YamlConfiguration.loadConfiguration(textContext.getCosmetics()));
|
noDropCosmeticService.load(YamlConfiguration.loadConfiguration(textContext.getCosmetics()));
|
||||||
|
|
||||||
|
dropConfirmService = getConfig().getBoolean("confirmThrowNoDropItem") ? new DropConfirmServiceImpl() : new DropConfirmNull();
|
||||||
NBTService nbtService = new Tr7zwNBTServiceImpl();
|
NBTService nbtService = new Tr7zwNBTServiceImpl();
|
||||||
noDropService = new NoDropServiceImpl(nbtService, noDropCosmeticService);
|
noDropService = new NoDropServiceImpl(nbtService, noDropCosmeticService);
|
||||||
NoDropItemFactory noDropItemFactory = new NoDropItemFactoryImpl(noDropService);
|
NoDropItemFactory noDropItemFactory = new NoDropItemFactoryImpl(noDropService);
|
||||||
@@ -123,7 +124,6 @@ public final class NoDropX extends JavaPlugin {
|
|||||||
.build();
|
.build();
|
||||||
itemStackService = initItemStackService();
|
itemStackService = initItemStackService();
|
||||||
|
|
||||||
dropConfirmService = getConfig().getBoolean("confirmThrowNoDropItem") ? new DropConfirmServiceImpl() : new DropConfirmNull();
|
|
||||||
|
|
||||||
menuFacade = initMenus();
|
menuFacade = initMenus();
|
||||||
StorageService storageService = new StorageServiceImpl(menuFacade, personalStorageRepo, noDropService);
|
StorageService storageService = new StorageServiceImpl(menuFacade, personalStorageRepo, noDropService);
|
||||||
@@ -147,7 +147,7 @@ public final class NoDropX extends JavaPlugin {
|
|||||||
commandManager.getMessageHandler().register("cmd.no.exists", sender -> messages.get("noExists").send(sender));
|
commandManager.getMessageHandler().register("cmd.no.exists", sender -> messages.get("noExists").send(sender));
|
||||||
commandManager.getMessageHandler().register("cmd.wrong.usage", sender -> messages.get("usage").send(sender));
|
commandManager.getMessageHandler().register("cmd.wrong.usage", sender -> messages.get("usage").send(sender));
|
||||||
commandManager.getCompletionHandler().register("#materials", input -> itemStackService.allMaterials());
|
commandManager.getCompletionHandler().register("#materials", input -> itemStackService.allMaterials());
|
||||||
commandManager.register(new NoDropCommand(messages, noDropAPI, menuFacade, this, itemStackService));
|
commandManager.register(new NoDropCommand(messages, noDropAPI, menuFacade, this, itemStackService, dropConfirmService));
|
||||||
bStatsInit();
|
bStatsInit();
|
||||||
printCredits();
|
printCredits();
|
||||||
checkUpdates();
|
checkUpdates();
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ import me.redtea.nodropx.NoDropX;
|
|||||||
import me.redtea.nodropx.api.facade.NoDropAPI;
|
import me.redtea.nodropx.api.facade.NoDropAPI;
|
||||||
import me.redtea.nodropx.menu.facade.MenuFacade;
|
import me.redtea.nodropx.menu.facade.MenuFacade;
|
||||||
import me.redtea.nodropx.libs.message.container.Messages;
|
import me.redtea.nodropx.libs.message.container.Messages;
|
||||||
|
import me.redtea.nodropx.service.dropconfirm.DropConfirmService;
|
||||||
import me.redtea.nodropx.service.material.ItemStackService;
|
import me.redtea.nodropx.service.material.ItemStackService;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -30,6 +32,7 @@ public class NoDropCommand extends CommandBase {
|
|||||||
private final MenuFacade menuFacade;
|
private final MenuFacade menuFacade;
|
||||||
private final NoDropX plugin;
|
private final NoDropX plugin;
|
||||||
private final ItemStackService itemStackService;
|
private final ItemStackService itemStackService;
|
||||||
|
private final DropConfirmService confirmService;
|
||||||
|
|
||||||
@Default
|
@Default
|
||||||
public void onDefault(final CommandSender sender) {
|
public void onDefault(final CommandSender sender) {
|
||||||
@@ -90,6 +93,60 @@ public class NoDropCommand extends CommandBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubCommand("ignoreConfirm")
|
||||||
|
@Permission("nodropx.ignoreConfirm")
|
||||||
|
public void onIgnoreConfirm(final CommandSender sender, @Optional Player target) {
|
||||||
|
if(target == null) {
|
||||||
|
if(!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage("player only");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
confirmService.forceConfirm((Player) sender);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
confirmService.forceConfirm(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand("ignoreConfirmTimed")
|
||||||
|
@Permission("nodropx.ignoreConfirm.timed")
|
||||||
|
public void onIgnoreConfirmTimed(final CommandSender sender, Integer sec, @Optional Player target) {
|
||||||
|
if(target == null) {
|
||||||
|
if(!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage("player only");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
confirmService.forceConfirm((Player) sender);
|
||||||
|
try {
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin,() -> confirmService.removeForceConfirm((Player) sender),20L*sec);
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "This operation didn't supports on your environment");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
confirmService.forceConfirm(target);
|
||||||
|
try {
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin,() -> confirmService.removeForceConfirm(target),20L*sec);
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "This operation didn't supports on your environment");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand("noIgnoreConfirm")
|
||||||
|
@Permission("nodropx.noIgnoreConfirm")
|
||||||
|
public void onNoIgnoreConfirm(final CommandSender sender, @Optional Player target) {
|
||||||
|
if(target == null) {
|
||||||
|
if(!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage("player only");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
confirmService.removeForceConfirm((Player) sender);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
confirmService.removeForceConfirm(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
@SubCommand("applyHand")
|
@SubCommand("applyHand")
|
||||||
@Permission("nodropx.applyhand")
|
@Permission("nodropx.applyhand")
|
||||||
public void onApplyHand(final Player sender) {
|
public void onApplyHand(final Player sender) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package me.redtea.nodropx.listener;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import me.redtea.nodropx.api.event.NoDropItemThrownEvent;
|
import me.redtea.nodropx.api.event.NoDropItemThrownEvent;
|
||||||
import me.redtea.nodropx.menu.facade.MenuFacade;
|
import me.redtea.nodropx.menu.facade.MenuFacade;
|
||||||
|
import me.redtea.nodropx.service.dropconfirm.DropConfirmService;
|
||||||
import me.redtea.nodropx.service.event.EventService;
|
import me.redtea.nodropx.service.event.EventService;
|
||||||
import me.redtea.nodropx.service.nodrop.NoDropService;
|
import me.redtea.nodropx.service.nodrop.NoDropService;
|
||||||
import me.redtea.nodropx.service.respawn.RespawnService;
|
import me.redtea.nodropx.service.respawn.RespawnService;
|
||||||
@@ -14,7 +15,10 @@ import org.bukkit.event.player.PlayerDropItemEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PlayerHandler implements Listener {
|
public class PlayerHandler implements Listener {
|
||||||
|
|||||||
@@ -6,4 +6,7 @@ public interface DropConfirmService {
|
|||||||
boolean isConfirmed(Player player);
|
boolean isConfirmed(Player player);
|
||||||
void confirm(Player player);
|
void confirm(Player player);
|
||||||
void resetConfirm(Player player);
|
void resetConfirm(Player player);
|
||||||
|
|
||||||
|
void forceConfirm(Player player);
|
||||||
|
void removeForceConfirm(Player player);
|
||||||
}
|
}
|
||||||
@@ -18,4 +18,14 @@ public class DropConfirmNull implements DropConfirmService {
|
|||||||
public void resetConfirm(Player player) {
|
public void resetConfirm(Player player) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceConfirm(Player player) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeForceConfirm(Player player) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,8 +9,10 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class DropConfirmServiceImpl implements DropConfirmService {
|
public class DropConfirmServiceImpl implements DropConfirmService {
|
||||||
private Set<UUID> confirmed = new HashSet<>();
|
private Set<UUID> confirmed = new HashSet<>();
|
||||||
|
private Set<UUID> force = new HashSet<>();
|
||||||
@Override
|
@Override
|
||||||
public boolean isConfirmed(Player player) {
|
public boolean isConfirmed(Player player) {
|
||||||
|
if(force.contains(player.getUniqueId()) || player.isDead()) return true;
|
||||||
return confirmed.contains(player.getUniqueId());
|
return confirmed.contains(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,4 +26,14 @@ public class DropConfirmServiceImpl implements DropConfirmService {
|
|||||||
confirmed.remove(player.getUniqueId());
|
confirmed.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceConfirm(Player player) {
|
||||||
|
force.add(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeForceConfirm(Player player) {
|
||||||
|
force.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import lombok.ToString;
|
|||||||
import me.redtea.nodropx.api.event.NoDropItemDropOnDeathEvent;
|
import me.redtea.nodropx.api.event.NoDropItemDropOnDeathEvent;
|
||||||
import me.redtea.nodropx.libs.carcadex.repo.Repo;
|
import me.redtea.nodropx.libs.carcadex.repo.Repo;
|
||||||
import me.redtea.nodropx.service.capasity.CapacityService;
|
import me.redtea.nodropx.service.capasity.CapacityService;
|
||||||
|
import me.redtea.nodropx.service.dropconfirm.DropConfirmService;
|
||||||
import me.redtea.nodropx.service.nodrop.NoDropService;
|
import me.redtea.nodropx.service.nodrop.NoDropService;
|
||||||
import me.redtea.nodropx.service.respawn.RespawnService;
|
import me.redtea.nodropx.service.respawn.RespawnService;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -31,7 +32,6 @@ public class RespawnServiceImpl implements RespawnService {
|
|||||||
for(Pair pair : pairs) player.getInventory().setItem(pair.slot, pair.item);
|
for(Pair pair : pairs) player.getInventory().setItem(pair.slot, pair.item);
|
||||||
toRespawn.remove(player.getName());
|
toRespawn.remove(player.getName());
|
||||||
}
|
}
|
||||||
player.updateInventory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ forceUseFoliaPatches: false
|
|||||||
|
|
||||||
checkForUpdates: true
|
checkForUpdates: true
|
||||||
|
|
||||||
confirmThrowNoDropItem: true
|
# Not recommended on Forge servers!
|
||||||
|
# Use it on your own risk
|
||||||
|
confirmThrowNoDropItem: false
|
||||||
|
|
||||||
#Single did not supports minimessages!
|
#Single did not supports minimessages!
|
||||||
#Can be SINGLE_PAGE or MULTI_PAGES
|
#Can be SINGLE_PAGE or MULTI_PAGES (Use MULTI_PAGES on your own risk)
|
||||||
personalStorageType: SINGLE_PAGE
|
personalStorageType: SINGLE_PAGE
|
||||||
Reference in new issue
Block a user