From 4ea21a8d7517e04e016088ecbee872792c1e2e43 Mon Sep 17 00:00:00 2001 From: TheTechRobo <52163910+TheTechRobo@users.noreply.github.com> Date: Mon, 21 Mar 2022 21:29:16 -0400 Subject: [PATCH] add setHearts command for ops --- plugin.yml | 8 ++++++- .../smp/ExploitAbuse101ByLunarRam.java | 21 +++++++++++++++++++ src/ca/thetechrobo/smp/LifestealPlugin.java | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/ca/thetechrobo/smp/ExploitAbuse101ByLunarRam.java diff --git a/plugin.yml b/plugin.yml index 8993944..e8c8115 100644 --- a/plugin.yml +++ b/plugin.yml @@ -6,4 +6,10 @@ api-version: 1.18 commands: deletemydata: description: Deletes your amount of lives, then bans you. - usage: "Usage: Not the way you used it, that's for sure" \ No newline at end of file + usage: "Usage: Not the way you used it, that's for sure" + setHearts: + permission: lifesteal.sethearts + +permissions: + lifesteal.sethearts: + default: op diff --git a/src/ca/thetechrobo/smp/ExploitAbuse101ByLunarRam.java b/src/ca/thetechrobo/smp/ExploitAbuse101ByLunarRam.java new file mode 100644 index 0000000..92740a6 --- /dev/null +++ b/src/ca/thetechrobo/smp/ExploitAbuse101ByLunarRam.java @@ -0,0 +1,21 @@ +package ca.thetechrobo.smp; + +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ExploitAbuse101ByLunarRam implements CommandExecutor { + @Override + public boolean onCommand(CommandSender senderr, Command arg1, String arg2, String[] args) { + if (args.length != 2) { + return false; + } + ScoreboardWrapper tmp = new ScoreboardWrapper(); + Player p = Bukkit.getPlayer(args[0]); + Double newHearts = Double.parseDouble(args[1]); + tmp.setHearts(p, newHearts); + return false; + } +} \ No newline at end of file diff --git a/src/ca/thetechrobo/smp/LifestealPlugin.java b/src/ca/thetechrobo/smp/LifestealPlugin.java index 71ef896..0d66da8 100644 --- a/src/ca/thetechrobo/smp/LifestealPlugin.java +++ b/src/ca/thetechrobo/smp/LifestealPlugin.java @@ -45,6 +45,7 @@ public class LifestealPlugin extends JavaPlugin { DeleteMyData dlmydata = new DeleteMyData(); dlmydata.initialise(dl.scores); this.getCommand("deletemydata").setExecutor(dlmydata); + this.getCommand("setHearts").setExecutor(new ExploitAbuse101ByLunarRam()); addRecipes(); } @Override