Most of it is done
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,97 +7,36 @@ description: Detect Block and Ban players who attempt to grief your server.
|
|||||||
website: https://thetrouper.github.io/
|
website: https://thetrouper.github.io/
|
||||||
softdepend: [ ProtocolLib ]
|
softdepend: [ ProtocolLib ]
|
||||||
permissions:
|
permissions:
|
||||||
ultradupe.message:
|
ultradupe.dupe:
|
||||||
description: Access to the direct messages
|
description: Access to the dupe
|
||||||
default: op
|
default: op
|
||||||
ultradupe.reply:
|
ultradupe.dupebans.edit:
|
||||||
description: Reply commands
|
description: edit the dupe ban list
|
||||||
ultradupe.debug:
|
|
||||||
description: Permission to use debug commands
|
|
||||||
default: op
|
default: op
|
||||||
ultradupe.staff:
|
ultradupe.dupebans:
|
||||||
description: Receive anti-swear and anti-spam warnings
|
description: see the dupe ban list
|
||||||
default: op
|
default: op
|
||||||
ultradupe.chat.antiswear.flags:
|
|
||||||
description: See antiSwear flags
|
|
||||||
default: op
|
|
||||||
ultradupe.chat.antiswear.bypass:
|
|
||||||
description: Bypass the antiSwear
|
|
||||||
default: op
|
|
||||||
ultradupe.chat.antiswear.edit:
|
|
||||||
description: Add a false positive to the config
|
|
||||||
default: op
|
|
||||||
ultradupe.chat.antispam.flags:
|
|
||||||
description: See antispam flags
|
|
||||||
default: op
|
|
||||||
ultradupe.chat.antispam.bypass:
|
|
||||||
description: Bypass the antispam
|
|
||||||
default: op
|
|
||||||
ultradupe.chat.*:
|
|
||||||
description: bypass all chat rules and see all flags
|
|
||||||
default: op
|
|
||||||
children:
|
|
||||||
ultradupe.chat.antiswear.flags: true
|
|
||||||
ultradupe.chat.antiswear.bypass: true
|
|
||||||
ultradupe.chat.antispam.flags: true
|
|
||||||
ultradupe.chat.antispam.bypass: true
|
|
||||||
commands:
|
commands:
|
||||||
ultradupetab:
|
|
||||||
description: trap tab completion command
|
|
||||||
usage: /ultradupetab you got trolled
|
|
||||||
ultradupe:
|
ultradupe:
|
||||||
description: A command for testing.
|
description: A command for testing.
|
||||||
usage: /ultradupe
|
usage: /ultradupe
|
||||||
permission: ultradupe.info
|
permission: ultradupe.info
|
||||||
permission-message: You do not have permission!
|
permission-message: You do not have permission!
|
||||||
reop:
|
|
||||||
description: Allows trusted players to elevate their permissions
|
|
||||||
usage: /reop
|
|
||||||
socialspy:
|
|
||||||
permission: ultradupe.spy
|
|
||||||
usage: /socialspy
|
|
||||||
permission-message: You do not have permission to use this command!
|
|
||||||
description: View direct messages sent between players
|
|
||||||
aliases:
|
aliases:
|
||||||
- spy
|
- dupe
|
||||||
- sspy
|
- d
|
||||||
msg:
|
- ud
|
||||||
permission: ultradupe.message
|
multiply:
|
||||||
usage: /msg <player> [<message>]
|
description: A command for testing.
|
||||||
permission-message: You do not have permission to message through ultradupe!
|
usage: /ultradupe
|
||||||
description: Send messages directly to players
|
permission: ultradupe.info
|
||||||
|
permission-message: You do not have permission!
|
||||||
aliases:
|
aliases:
|
||||||
- message
|
- mult
|
||||||
- etell
|
|
||||||
- tell
|
|
||||||
- t
|
|
||||||
- ewhisper
|
|
||||||
- whisper
|
|
||||||
- w
|
|
||||||
- privatemessage
|
|
||||||
- pm
|
|
||||||
- m
|
- m
|
||||||
- directmessage
|
- um
|
||||||
- dm
|
dupebans:
|
||||||
- ultradupemessage
|
description: dupe bans
|
||||||
- sm
|
usage: /dupebans [add|remove]
|
||||||
- stell
|
permission: ultradupe.dupebans
|
||||||
- smsg
|
|
||||||
reply:
|
|
||||||
description: Reply to the last person messaging you
|
|
||||||
usage: /r [<message>]
|
|
||||||
permission: ultradupe.reply
|
|
||||||
permission-message: You do not have permission to reply through ultradupe!
|
|
||||||
aliases:
|
|
||||||
- r
|
|
||||||
- er
|
|
||||||
- rply
|
|
||||||
- ereply
|
|
||||||
- sr
|
|
||||||
- sreply
|
|
||||||
- ultradupereply
|
|
||||||
ultradupecallback:
|
|
||||||
description: Callback for chat click events
|
|
||||||
usage: /ultradupecallback
|
|
||||||
permission: ultradupe.callbacks
|
|
||||||
permission-message: You have not been given permission to use UltraDupe Chat Callbacks!
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,9 +2,12 @@ package io.github.thetrouper.ultradupe;
|
|||||||
|
|
||||||
import io.github.itzispyder.pdk.PDK;
|
import io.github.itzispyder.pdk.PDK;
|
||||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||||
import io.github.thetrouper.ultradupe.cmds.ChatClickCallback;
|
import io.github.thetrouper.ultradupe.cmds.DupeBansCommand;
|
||||||
|
import io.github.thetrouper.ultradupe.cmds.DupeCommand;
|
||||||
|
import io.github.thetrouper.ultradupe.cmds.MultiplyCommand;
|
||||||
|
import io.github.thetrouper.ultradupe.data.DupeBanStorage;
|
||||||
import io.github.thetrouper.ultradupe.data.config.Config;
|
import io.github.thetrouper.ultradupe.data.config.Config;
|
||||||
import io.github.thetrouper.ultradupe.events.ChatEvent;
|
import io.github.thetrouper.ultradupe.events.GuiEvents;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@@ -16,7 +19,9 @@ public final class UltraDupe extends JavaPlugin {
|
|||||||
|
|
||||||
private static UltraDupe instance;
|
private static UltraDupe instance;
|
||||||
private static final File cfgfile = new File("plugins/UltraDupe/main-config.json");
|
private static final File cfgfile = new File("plugins/UltraDupe/main-config.json");
|
||||||
|
private static final File dupeBans = new File("plugins/UltraDupe/dupebans.json");
|
||||||
public static Config config = JsonSerializable.load(cfgfile, Config.class, new Config());
|
public static Config config = JsonSerializable.load(cfgfile, Config.class, new Config());
|
||||||
|
public static DupeBanStorage dupeBanStorage = JsonSerializable.load(dupeBans, DupeBanStorage.class, new DupeBanStorage());
|
||||||
public static final PluginManager manager = Bukkit.getPluginManager();
|
public static final PluginManager manager = Bukkit.getPluginManager();
|
||||||
|
|
||||||
public static final Logger log = Bukkit.getLogger();
|
public static final Logger log = Bukkit.getLogger();
|
||||||
@@ -45,10 +50,12 @@ public final class UltraDupe extends JavaPlugin {
|
|||||||
log.info("Starting Up! (%s)...".formatted(getDescription().getVersion()));
|
log.info("Starting Up! (%s)...".formatted(getDescription().getVersion()));
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
new ChatClickCallback().register();
|
new DupeCommand().register();
|
||||||
|
new DupeBansCommand().register();
|
||||||
|
new MultiplyCommand().register();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
new ChatEvent().register();
|
new GuiEvents().register();
|
||||||
|
|
||||||
log.info("""
|
log.info("""
|
||||||
Finished!
|
Finished!
|
||||||
@@ -68,9 +75,11 @@ public final class UltraDupe extends JavaPlugin {
|
|||||||
|
|
||||||
// Init
|
// Init
|
||||||
config = JsonSerializable.load(cfgfile, Config.class,new Config());
|
config = JsonSerializable.load(cfgfile, Config.class,new Config());
|
||||||
|
dupeBanStorage = JsonSerializable.load(dupeBans, DupeBanStorage.class,new DupeBanStorage());
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
config.save();
|
config.save();
|
||||||
|
dupeBanStorage.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package io.github.thetrouper.ultradupe.cmds;
|
|
||||||
|
|
||||||
import io.github.itzispyder.pdk.commands.Args;
|
|
||||||
import io.github.itzispyder.pdk.commands.CommandRegistry;
|
|
||||||
import io.github.itzispyder.pdk.commands.CustomCommand;
|
|
||||||
import io.github.itzispyder.pdk.commands.Permission;
|
|
||||||
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
@CommandRegistry(value = "ultradupe", permission = @Permission("ultradupe.dupe"), printStackTrace = true)
|
|
||||||
public class ChatClickCallback implements CustomCommand {
|
|
||||||
@Override
|
|
||||||
public void dispatchCommand(CommandSender sender, Args args) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispatchCompletions(CompletionBuilder b) {
|
|
||||||
b.then(b.arg());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package io.github.thetrouper.ultradupe.cmds;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.Global;
|
||||||
|
import io.github.itzispyder.pdk.commands.Args;
|
||||||
|
import io.github.itzispyder.pdk.commands.CommandRegistry;
|
||||||
|
import io.github.itzispyder.pdk.commands.CustomCommand;
|
||||||
|
import io.github.itzispyder.pdk.commands.Permission;
|
||||||
|
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
||||||
|
import io.github.thetrouper.ultradupe.UltraDupe;
|
||||||
|
import io.github.thetrouper.ultradupe.data.DupeBanStorage;
|
||||||
|
import io.github.thetrouper.ultradupe.data.GUIs.DupeBanGUI;
|
||||||
|
import io.github.thetrouper.ultradupe.server.functions.DupeBanCheck;
|
||||||
|
import io.github.thetrouper.ultradupe.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.ultradupe.server.util.Text;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@CommandRegistry(value = "dupebans", permission = @Permission("ultradupe.dupebans"), printStackTrace = true)
|
||||||
|
public class DupeBansCommand implements CustomCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispatchCommand(CommandSender sender, Args args) {
|
||||||
|
Player p = (Player) sender;
|
||||||
|
switch (args.get(0).toString()) {
|
||||||
|
case "add" -> {
|
||||||
|
if (!p.hasPermission("ultradupe.dupebans.edit")) return;
|
||||||
|
Material m = p.getInventory().getItemInMainHand().getType();
|
||||||
|
if (UltraDupe.dupeBanStorage.dupeBans.contains(m)) {
|
||||||
|
p.sendMessage(Component.text(Text.prefix("&7The material &c%s&7 is already on the dupe ban listr.".formatted(Text.cleanName(m.toString())))));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UltraDupe.dupeBanStorage.dupeBans.add(m);
|
||||||
|
p.sendMessage(Component.text(Text.prefix("&7You have added &c%s&7 to the dupe ban list.".formatted(Text.cleanName(m.toString())))));
|
||||||
|
UltraDupe.dupeBanStorage.save();
|
||||||
|
}
|
||||||
|
case "remove" -> {
|
||||||
|
if (!p.hasPermission("ultradupe.dupebans.edit")) return;
|
||||||
|
Material m = p.getInventory().getItemInMainHand().getType();
|
||||||
|
if (!UltraDupe.dupeBanStorage.dupeBans.contains(m)) {
|
||||||
|
p.sendMessage(Component.text(Text.prefix("&7The material &c%s&7 is not on the dupe ban list.".formatted(Text.cleanName(m.toString())))));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UltraDupe.dupeBanStorage.dupeBans.remove(m);
|
||||||
|
p.sendMessage(Component.text(Text.prefix("&7You have removed &a%s&7 from the dupe ban list.".formatted(Text.cleanName(m.toString())))));
|
||||||
|
UltraDupe.dupeBanStorage.save();
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
StringBuilder dupeBanList = new StringBuilder(Text.prefix("&7There are currently &e%s&7 dupe bans.".formatted(UltraDupe.dupeBanStorage.dupeBans.size())));
|
||||||
|
for (Material dupeBan : UltraDupe.dupeBanStorage
|
||||||
|
.dupeBans) {
|
||||||
|
dupeBanList.append(Global.instance.color("\n&6 - &c%s".formatted(Text.cleanName(dupeBan.toString()))));
|
||||||
|
}
|
||||||
|
p.sendMessage(dupeBanList.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispatchCompletions(CompletionBuilder b) {
|
||||||
|
b.then(b.arg("add","remove"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package io.github.thetrouper.ultradupe.cmds;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.commands.Args;
|
||||||
|
import io.github.itzispyder.pdk.commands.CommandRegistry;
|
||||||
|
import io.github.itzispyder.pdk.commands.CustomCommand;
|
||||||
|
import io.github.itzispyder.pdk.commands.Permission;
|
||||||
|
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.thetrouper.ultradupe.server.functions.DupeBanCheck;
|
||||||
|
import io.github.thetrouper.ultradupe.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.ultradupe.server.util.Text;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
@CommandRegistry(value = "ultradupe", permission = @Permission("ultradupe.dupe"), printStackTrace = true)
|
||||||
|
public class DupeCommand implements CustomCommand {
|
||||||
|
|
||||||
|
DupeBanCheck check = new DupeBanCheck();
|
||||||
|
@Override
|
||||||
|
public void dispatchCommand(CommandSender sender, Args args) {
|
||||||
|
Player p = (Player) sender;
|
||||||
|
SoundPlayer yes = new SoundPlayer(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 10,1);
|
||||||
|
SoundPlayer no = new SoundPlayer(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 10,1);
|
||||||
|
|
||||||
|
if (p.getInventory().getItemInMainHand().isEmpty()) {
|
||||||
|
p.sendMessage(Component.text(Text.prefix("That was air... it was duped, but you still didn't get anything.")));
|
||||||
|
no.play(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int factor = args.get(0).toInt();
|
||||||
|
ItemStack i = p.getInventory().getItemInMainHand().clone();
|
||||||
|
|
||||||
|
if (check.itemPasses(i)) {
|
||||||
|
if (factor == 0) factor = i.getAmount();
|
||||||
|
SchedulerUtils.loop(1,factor,(time)->{
|
||||||
|
i.setAmount(1);
|
||||||
|
yes.play(p);
|
||||||
|
p.getInventory().addItem(i);
|
||||||
|
});
|
||||||
|
p.sendMessage(Component.text(Text.prefix("&7You have duped &a%s %s&7.".formatted(factor, Text.cleanName(i.getType().toString())))));
|
||||||
|
} else {
|
||||||
|
p.sendMessage(Component.text(Text.prefix("&cYou are not allowed to dupe &7%s&c.".formatted(Text.cleanName(i.getType().toString())))));
|
||||||
|
no.play(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispatchCompletions(CompletionBuilder b) {
|
||||||
|
b.then(b.arg("[<INT>]"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package io.github.thetrouper.ultradupe.cmds;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.commands.Args;
|
||||||
|
import io.github.itzispyder.pdk.commands.CommandRegistry;
|
||||||
|
import io.github.itzispyder.pdk.commands.CustomCommand;
|
||||||
|
import io.github.itzispyder.pdk.commands.Permission;
|
||||||
|
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.thetrouper.ultradupe.server.functions.DupeBanCheck;
|
||||||
|
import io.github.thetrouper.ultradupe.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.ultradupe.server.util.Text;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@CommandRegistry(value = "multiply", permission = @Permission("ultradupe.multiply"), printStackTrace = true)
|
||||||
|
public class MultiplyCommand implements CustomCommand {
|
||||||
|
|
||||||
|
DupeBanCheck check = new DupeBanCheck();
|
||||||
|
@Override
|
||||||
|
public void dispatchCommand(CommandSender sender, Args args) {
|
||||||
|
Player p = (Player) sender;
|
||||||
|
SoundPlayer yes = new SoundPlayer(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 10,1);
|
||||||
|
SoundPlayer no = new SoundPlayer(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 10,1);
|
||||||
|
|
||||||
|
if (p.getInventory().getItemInMainHand().isEmpty()) {
|
||||||
|
p.sendMessage(Component.text(Text.prefix("That was air... it was duped, but you still didn't get anything.")));
|
||||||
|
no.play(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int factor = args.get(0).toInt();
|
||||||
|
ItemStack i = p.getInventory().getItemInMainHand().clone();
|
||||||
|
|
||||||
|
if (check.itemPasses(i)) {
|
||||||
|
if (factor == 0) factor = i.getAmount();
|
||||||
|
SchedulerUtils.loop(1,factor,(time)->{
|
||||||
|
yes.play(p);
|
||||||
|
p.getInventory().addItem(i);
|
||||||
|
});
|
||||||
|
p.sendMessage(Component.text(Text.prefix("&7You have duped &a%s %s&7.".formatted(factor, Text.cleanName(i.getType().toString())))));
|
||||||
|
} else {
|
||||||
|
p.sendMessage(Component.text(Text.prefix("&cYou are not allowed to dupe &7%s&c.".formatted(Text.cleanName(i.getType().toString())))));
|
||||||
|
no.play(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispatchCompletions(CompletionBuilder b) {
|
||||||
|
b.then(b.arg("[<INT>]"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package io.github.thetrouper.ultradupe.data;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DupeBanStorage implements JsonSerializable<DupeBanStorage> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getFile() {
|
||||||
|
File file = new File("plugins/UltraDupe/dupebans.json");
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
public int bannedModelData = 1111;
|
||||||
|
public List<Material> dupeBans = Arrays.asList(
|
||||||
|
Material.AZALEA,
|
||||||
|
Material.BIG_DRIPLEAF
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package io.github.thetrouper.ultradupe.data.GUIs;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.Global;
|
||||||
|
import io.github.itzispyder.pdk.plugin.builders.ItemBuilder;
|
||||||
|
import io.github.itzispyder.pdk.plugin.gui.CustomGui;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.SoundPlayer;
|
||||||
|
import io.github.thetrouper.ultradupe.UltraDupe;
|
||||||
|
import io.github.thetrouper.ultradupe.data.DupeBanStorage;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class DupeBanGUI implements Global {
|
||||||
|
static Global g = Global.instance;
|
||||||
|
|
||||||
|
public static List<UUID> isInGUI = new ArrayList<>();
|
||||||
|
|
||||||
|
public static final CustomGui home = CustomGui.create()
|
||||||
|
.title(g.color("A88FF&lUʺCFF&llỒFF<≚FF&lr◣FF&la&#A59DFF&lD&#B4A1FF&lu&#C3A5FF&lp&#D2A9FF&le &7&l | &#FF5A5A&l&nP&#F25C62&l&nr&#E65E6B&l&ne&#D95F73&l&nm&#CC617B&l&ni&#BF6383&l&nu&#B3658C&l&nm &#A66794&l&nD𘕩C&l&nuC6AA4&l&np̦CAD&l&ne ˠEB5&l&nBᨎBD&l&naᝓC5&l&nnD73CE&l&ns ࿫D6&l&nEറDE&l&nd੷E6&l&niA7AEF&l&nt�D7CF7&l&noEFF&l&nr"))
|
||||||
|
.size(54)
|
||||||
|
.defineMain(e -> {
|
||||||
|
e.setCancelled(true);
|
||||||
|
if (!isInGUI.contains(e.getWhoClicked().getUniqueId())) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
e.getWhoClicked().setHealth(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.getClickedInventory().getItem(e.getSlot()).getType().equals(Material.LIGHT_GRAY_STAINED_GLASS_PANE)) {
|
||||||
|
SoundPlayer deny = new SoundPlayer(e.getWhoClicked().getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS,1,1);
|
||||||
|
deny.play((Player) e.getWhoClicked());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.onDefine(e -> {
|
||||||
|
|
||||||
|
})
|
||||||
|
.define(54,GuiItems.nextArrow,event -> {
|
||||||
|
|
||||||
|
})
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package io.github.thetrouper.ultradupe.data.GUIs;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.Global;
|
||||||
|
import io.github.itzispyder.pdk.plugin.builders.ItemBuilder;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class GuiItems implements Global {
|
||||||
|
static Global g = Global.instance;
|
||||||
|
|
||||||
|
public static final ItemStack nextArrow = ItemBuilder.create()
|
||||||
|
.material(Material.ARROW)
|
||||||
|
.name(g.color("Next Page"))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final ItemStack backArrow = ItemBuilder.create()
|
||||||
|
.material(Material.ARROW)
|
||||||
|
.name(g.color("Previous Page"))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package io.github.thetrouper.ultradupe.events;
|
|
||||||
|
|
||||||
import io.github.itzispyder.pdk.events.CustomListener;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
||||||
|
|
||||||
public class ChatEvent implements CustomListener {
|
|
||||||
@EventHandler
|
|
||||||
private void onChat(AsyncPlayerChatEvent e) {
|
|
||||||
handleChatEvent(e);
|
|
||||||
}
|
|
||||||
public static void handleChatEvent(AsyncPlayerChatEvent e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package io.github.thetrouper.ultradupe.events;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.events.CustomListener;
|
||||||
|
import io.github.thetrouper.ultradupe.data.GUIs.DupeBanGUI;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
|
|
||||||
|
public class GuiEvents implements CustomListener {
|
||||||
|
@EventHandler
|
||||||
|
private void onGuiClose(InventoryCloseEvent e) {
|
||||||
|
DupeBanGUI.isInGUI.remove(e.getPlayer().getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package io.github.thetrouper.ultradupe.server.functions;
|
||||||
|
|
||||||
|
import io.github.thetrouper.ultradupe.UltraDupe;
|
||||||
|
import io.github.thetrouper.ultradupe.data.DupeBanStorage;
|
||||||
|
import io.github.thetrouper.ultradupe.server.util.ServerUtils;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.Container;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
public class DupeBanCheck {
|
||||||
|
private boolean isContainer(ItemStack itemStack) {
|
||||||
|
return itemStack.getType() == Material.CHEST ||
|
||||||
|
itemStack.getType() == Material.TRAPPED_CHEST ||
|
||||||
|
itemStack.getType() == Material.FURNACE ||
|
||||||
|
itemStack.getType() == Material.BLAST_FURNACE ||
|
||||||
|
itemStack.getType() == Material.DROPPER ||
|
||||||
|
itemStack.getType() == Material.DISPENSER ||
|
||||||
|
itemStack.getType() == Material.HOPPER ||
|
||||||
|
itemStack.getType() == Material.BARREL;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Inventory getSubInventory(ItemStack containerItem) {
|
||||||
|
ServerUtils.verbose("DUPEBANS: GetSubInv checking item: " + containerItem);
|
||||||
|
if (containerItem.getItemMeta() instanceof BlockStateMeta blockStateMeta) {
|
||||||
|
ServerUtils.verbose("DUPEBANS: subInv has (is) blockStateMeta: " + blockStateMeta);
|
||||||
|
BlockState blockState = blockStateMeta.getBlockState();
|
||||||
|
if (blockState instanceof Container) {
|
||||||
|
ServerUtils.verbose("DUPEBANS: subInv has (is) container: " + (Container) blockState);
|
||||||
|
return ((Container) blockState).getInventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ServerUtils.verbose("DUPEBANS: Inv is null: " + containerItem);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean containerPasses(Inventory inventory) {
|
||||||
|
for (ItemStack itemStack : inventory.getContents()) {
|
||||||
|
if (itemStack == null || itemStack.getType().isAir()) continue;
|
||||||
|
if (!itemPasses(itemStack)) {
|
||||||
|
ServerUtils.verbose("DUPEBANS: No pass C(I)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isContainer(itemStack)) continue;
|
||||||
|
|
||||||
|
Inventory subInventory = getSubInventory(itemStack);
|
||||||
|
if (!containerPasses(subInventory)) {
|
||||||
|
ServerUtils.verbose("DUPEBANS: No pass C(R)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ServerUtils.verbose("DUPEBANS: Item passes recursion check.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean itemPasses(ItemStack i) {
|
||||||
|
ServerUtils.verbose("DUPEBANS: Checking if item passes: " + i.getItemMeta());
|
||||||
|
Inventory inv = getSubInventory(i);
|
||||||
|
if (inv != null) {
|
||||||
|
ServerUtils.verbose("DUPEBANS: Item has a SubInv: " + inv);
|
||||||
|
if (!containerPasses(inv)) {
|
||||||
|
ServerUtils.verbose("DUPEBANS: No pass C");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (UltraDupe.dupeBanStorage.dupeBans.contains(i.getType())) {
|
||||||
|
ServerUtils.verbose("DUPEBANS: No pass T");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (i.hasItemMeta() && i.getItemMeta().hasCustomModelData() && i.getItemMeta().getCustomModelData() == UltraDupe.dupeBanStorage.bannedModelData) {
|
||||||
|
ServerUtils.verbose("DUPEBANS: No pass M");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerUtils.verbose("DUPEBANS: All checks passed");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,97 +7,36 @@ description: Detect Block and Ban players who attempt to grief your server.
|
|||||||
website: https://thetrouper.github.io/
|
website: https://thetrouper.github.io/
|
||||||
softdepend: [ ProtocolLib ]
|
softdepend: [ ProtocolLib ]
|
||||||
permissions:
|
permissions:
|
||||||
ultradupe.message:
|
ultradupe.dupe:
|
||||||
description: Access to the direct messages
|
description: Access to the dupe
|
||||||
default: op
|
default: op
|
||||||
ultradupe.reply:
|
ultradupe.dupebans.edit:
|
||||||
description: Reply commands
|
description: edit the dupe ban list
|
||||||
ultradupe.debug:
|
|
||||||
description: Permission to use debug commands
|
|
||||||
default: op
|
default: op
|
||||||
ultradupe.staff:
|
ultradupe.dupebans:
|
||||||
description: Receive anti-swear and anti-spam warnings
|
description: see the dupe ban list
|
||||||
default: op
|
default: op
|
||||||
ultradupe.chat.antiswear.flags:
|
|
||||||
description: See antiSwear flags
|
|
||||||
default: op
|
|
||||||
ultradupe.chat.antiswear.bypass:
|
|
||||||
description: Bypass the antiSwear
|
|
||||||
default: op
|
|
||||||
ultradupe.chat.antiswear.edit:
|
|
||||||
description: Add a false positive to the config
|
|
||||||
default: op
|
|
||||||
ultradupe.chat.antispam.flags:
|
|
||||||
description: See antispam flags
|
|
||||||
default: op
|
|
||||||
ultradupe.chat.antispam.bypass:
|
|
||||||
description: Bypass the antispam
|
|
||||||
default: op
|
|
||||||
ultradupe.chat.*:
|
|
||||||
description: bypass all chat rules and see all flags
|
|
||||||
default: op
|
|
||||||
children:
|
|
||||||
ultradupe.chat.antiswear.flags: true
|
|
||||||
ultradupe.chat.antiswear.bypass: true
|
|
||||||
ultradupe.chat.antispam.flags: true
|
|
||||||
ultradupe.chat.antispam.bypass: true
|
|
||||||
commands:
|
commands:
|
||||||
ultradupetab:
|
|
||||||
description: trap tab completion command
|
|
||||||
usage: /ultradupetab you got trolled
|
|
||||||
ultradupe:
|
ultradupe:
|
||||||
description: A command for testing.
|
description: A command for testing.
|
||||||
usage: /ultradupe
|
usage: /ultradupe
|
||||||
permission: ultradupe.info
|
permission: ultradupe.info
|
||||||
permission-message: You do not have permission!
|
permission-message: You do not have permission!
|
||||||
reop:
|
|
||||||
description: Allows trusted players to elevate their permissions
|
|
||||||
usage: /reop
|
|
||||||
socialspy:
|
|
||||||
permission: ultradupe.spy
|
|
||||||
usage: /socialspy
|
|
||||||
permission-message: You do not have permission to use this command!
|
|
||||||
description: View direct messages sent between players
|
|
||||||
aliases:
|
aliases:
|
||||||
- spy
|
- dupe
|
||||||
- sspy
|
- d
|
||||||
msg:
|
- ud
|
||||||
permission: ultradupe.message
|
multiply:
|
||||||
usage: /msg <player> [<message>]
|
description: A command for testing.
|
||||||
permission-message: You do not have permission to message through ultradupe!
|
usage: /ultradupe
|
||||||
description: Send messages directly to players
|
permission: ultradupe.info
|
||||||
|
permission-message: You do not have permission!
|
||||||
aliases:
|
aliases:
|
||||||
- message
|
- mult
|
||||||
- etell
|
|
||||||
- tell
|
|
||||||
- t
|
|
||||||
- ewhisper
|
|
||||||
- whisper
|
|
||||||
- w
|
|
||||||
- privatemessage
|
|
||||||
- pm
|
|
||||||
- m
|
- m
|
||||||
- directmessage
|
- um
|
||||||
- dm
|
dupebans:
|
||||||
- ultradupemessage
|
description: dupe bans
|
||||||
- sm
|
usage: /dupebans [add|remove]
|
||||||
- stell
|
permission: ultradupe.dupebans
|
||||||
- smsg
|
|
||||||
reply:
|
|
||||||
description: Reply to the last person messaging you
|
|
||||||
usage: /r [<message>]
|
|
||||||
permission: ultradupe.reply
|
|
||||||
permission-message: You do not have permission to reply through ultradupe!
|
|
||||||
aliases:
|
|
||||||
- r
|
|
||||||
- er
|
|
||||||
- rply
|
|
||||||
- ereply
|
|
||||||
- sr
|
|
||||||
- sreply
|
|
||||||
- ultradupereply
|
|
||||||
ultradupecallback:
|
|
||||||
description: Callback for chat click events
|
|
||||||
usage: /ultradupecallback
|
|
||||||
permission: ultradupe.callbacks
|
|
||||||
permission-message: You have not been given permission to use UltraDupe Chat Callbacks!
|
|
||||||
Reference in New Issue
Block a user