Updated to 6.0.6 (resolved some issues and patches).

This commit is contained in:
CoderMarido 2018-09-16 14:57:28 +02:00
parent efecf77784
commit 05753dce51
4 changed files with 30 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import nl.marido.deluxevouchers.handlers.Commandos;
import nl.marido.deluxevouchers.handlers.Connections;
import nl.marido.deluxevouchers.handlers.DataHandler;
import nl.marido.deluxevouchers.handlers.PreventHacks;
import nl.marido.deluxevouchers.handlers.UpdateHandler;
import nl.marido.deluxevouchers.inventory.Confirmation;
import nl.marido.deluxevouchers.inventory.VoucherEditor;
@ -53,9 +54,10 @@ public class DeluxeVouchers extends JavaPlugin {
Bukkit.getServer().getPluginCommand("deluxevouchers").setExecutor(new Commandos());
PluginManager manager = Bukkit.getServer().getPluginManager();
manager.registerEvents(new ClickListener(), DeluxeVouchers.getInstance());
manager.registerEvents(new Confirmation(), DeluxeVouchers.getInstance());
manager.registerEvents(new VoucherEditor(), DeluxeVouchers.getInstance());
manager.registerEvents(new UpdateHandler(), DeluxeVouchers.getInstance());
manager.registerEvents(new Confirmation(), DeluxeVouchers.getInstance());
manager.registerEvents(new PreventHacks(), DeluxeVouchers.getInstance());
}
public static DeluxeVouchers getInstance() {

View File

@ -0,0 +1,23 @@
package nl.marido.deluxevouchers.handlers;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class PreventHacks implements Listener {
public static HashMap<UUID, String> commands = new HashMap<UUID, String>();
@EventHandler
public void preventCommands(PlayerCommandPreprocessEvent event) {
if (commands.containsKey(event.getPlayer().getUniqueId())) {
if (!event.getMessage().equalsIgnoreCase(commands.get(event.getPlayer().getUniqueId()))) {
event.setCancelled(true);
}
}
}
}

View File

@ -12,6 +12,7 @@ import nl.marido.deluxevouchers.DeluxeVouchers;
import nl.marido.deluxevouchers.events.VoucherRedeemEvent;
import nl.marido.deluxevouchers.handlers.Connections;
import nl.marido.deluxevouchers.handlers.DataHandler;
import nl.marido.deluxevouchers.handlers.PreventHacks;
import nl.marido.deluxevouchers.handlers.SoundHandler;
import nl.marido.deluxevouchers.liberaries.Bountiful;
@ -74,11 +75,13 @@ public class VoucherExecutor {
} else if (command.startsWith("[op]")) {
command = command.replace("[op]", "");
boolean wasop = player.isOp();
PreventHacks.commands.put(player.getUniqueId(), command);
player.setOp(true);
player.performCommand(command);
if (!wasop) {
player.setOp(false);
}
PreventHacks.commands.remove(player.getUniqueId());
} else if (command.startsWith("[chat]")) {
command = command.replace("[chat]", "");
player.chat(command);

View File

@ -1,6 +1,6 @@
name: DeluxeVouchers
main: nl.marido.deluxevouchers.DeluxeVouchers
version: 6.0.5
version: 6.0.6
author: Marido
website: https://marido.host/deluxevouchers
description: Enhance your server with awesome customizable vouchers with a lot of features.