Need help changing stuff inside the .class files.

Posts 111 of 11 · Page 1 of 1
Need help changing stuff inside the .class files.
Hi, so i'm using a java decompiler and I want to edit this .class (its a plugin and it gives a diamond sword unbreaking, sharpness, fire aspect, knockback on VII (7) I want to edit it so it adds smite 7 but i'm not sure how. If someone who knows how to do this can reply i might just post a screen shot.

Edit : Using eclipse and still don't know what to do
Look at how other enchantments are added.Profit.
Quote Originally Posted by C++Coding View Post
Look at how other enchantments are added.Profit.
Yea I looked but I dont know what smite is....

---------- Post added at 08:07 PM ---------- Previous post was at 07:44 PM ----------

This is what I did
: decompile then save source, open source with eclipse and this is what shows up

/* */ package GodSword;
/* */
/* */ import java.util.logging.Logger;
/* */ import org.bukkit.ChatColor;
/* */ import org.bukkit.Material;
/* */ import org.bukkit.Server;
/* */ import org.bukkit.command.Command;
/* */ import org.bukkit.command.CommandSender;
/* */ import org.bukkit.enchantments.Enchantment;
/* */ import org.bukkit.entity.Player;
/* */ import org.bukkit.inventory.ItemStack;
/* */ import org.bukkit.inventory.PlayerInventory;
/* */ import org.bukkit.plugin.java.JavaPlugin;
/* */
/* */ public class GodSword extends JavaPlugin
/* */ {
/* */ public void onEnable()
/* */ {
/* 17 */ getLogger().info("GodSword is starting up...");
/* */ }
/* */
/* */ public void onDisable()
/* */ {
/* 22 */ getLogger().info("GodSword is shutting down...");
/* */ }
/* */
/* */ public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
/* 26 */ if (label.equalsIgnoreCase("gsword")) {
/* 27 */ if (args.length == 0) {
/* 28 */ if ((sender instanceof Player)) {
/* 29 */ Player target = (Player)sender;
/* 30 */ ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
/* 31 */ PlayerInventory inv = target.getInventory();
/* 32 */ sword.addUnsafeEnchantment(Enchantment.KNOCKBACK, 7);
/* 33 */ sword.addUnsafeEnchantment(Enchantment.FIRE_ASPECT , 7);
/* 34 */ sword.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
/* 35 */ sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 7);
/* 36 */ inv.addItem(new ItemStack[] { sword });
/* */ }
/* 38 */ if (!(sender instanceof Player))
/* 39 */ sender.sendMessage("This command can only be run by a player!");
/* */ }
/* 41 */ else if (args.length == 1) {
/* 42 */ Player target = getServer().getPlayer(args[0]);
/* 43 */ if ((sender instanceof Player)) {
/* */ try {
/* 45 */ ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
/* 46 */ PlayerInventory inv = target.getInventory();
/* 47 */ sword.addUnsafeEnchantment(Enchantment.KNOCKBACK, 7);
/* 48 */ sword.addUnsafeEnchantment(Enchantment.FIRE_ASPECT , 7);
/* 49 */ sword.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
/* 50 */ sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 7);
/* 51 */ inv.addItem(new ItemStack[] { sword });
/* */ } catch (Exception e) {
/* 53 */ target.sendMessage(ChatColor.DARK_RED + target.getDisplayName().toString() + " is not online!");
/* */ }
/* */ }
/* 56 */ if (!(sender instanceof Player)) {
/* */ try {
/* 58 */ ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
/* 59 */ PlayerInventory inv = target.getInventory();
/* 60 */ sword.addUnsafeEnchantment(Enchantment.KNOCKBACK, 7);
/* 61 */ sword.addUnsafeEnchantment(Enchantment.FIRE_ASPECT , 7);
/* 62 */ sword.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
/* 63 */ sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 7);
/* 64 */ inv.addItem(new ItemStack[] { sword });
/* */ } catch (Exception e) {
/* 66 */ target.sendMessage(ChatColor.DARK_RED + target.getDisplayName().toString() + " is not online!");
/* */ }
/* */ }
/* */ }
/* */ }
sword.addUnsafeEnchantment(Enchantment.SMITE, 7);

win?
Is Smite declared already as an enchantment? I don't see one there, but maybe because it can't go up to 7. Though, just try added what I said above near wear everything else is.

IE; under sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 7);
Quote Originally Posted by Psychotic View Post
sword.addUnsafeEnchantment(Enchantment.SMITE, 7);

win?
Is Smite declared already as an enchantment? I don't see one there, but maybe because it can't go up to 7. Though, just try added what I said above near wear everything else is.

IE; under sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 7);
Ok but on the side there are like 40,41,42 and idk if it conflicts with it. and doesnt smite have its own name or something>?

Can I just pm you the whole code?
Quote Originally Posted by SoundBlaster View Post
Ok but on the side there are like 40,41,42 and idk if it conflicts with it. and doesnt smite have its own name or something>?

Can I just pm you the whole code?
No, those are comments. Anything inside "//" or "/* */" are comments, so the numbers don't matter. They don't conflict with it at all. Also, try just putting what I said; if you get an error (like an underline under the word SMITE) then it probably hasn't been declared and there's a different name for it.
Quote Originally Posted by Psychotic View Post


No, those are comments. Anything inside "//" or "/* */" are comments, so the numbers don't matter. They don't conflict with it at all. Also, try just putting what I said; if you get an error (like an underline under the word SMITE) then it probably hasn't been declared and there's a different name for it.
Okay, thanks ill test it out
<!DOCTYPE html>
<html>
<head>
<title>Nope</title>
</head>
<body>
<h1>Nope.avi</h1>
<p>Learn to code it yourself</p>
</body>



</html>
<!DOCTYPE html>
<html>
<head>
<title>Method Display</title>
</head>
<body>
<h1>Eclipse has member display</h1>
<p>Eclipse has this special thing call member did so all you gotta do it type Enchantment. in the parameters and all possibilities will show up in a box. </p>
</body>



</html>
K i saved it into a .class. After that i put them all into a .rar file and renamed it into .jar. ran the server but says couldnt load. Was it because i named the .rar into a .jar?

And how do i change .java to .class
Quote Originally Posted by SoundBlaster View Post
K i saved it into a .class. After that i put them all into a .rar file and renamed it into .jar. ran the server but says couldnt load. Was it because i named the .rar into a .jar?

And how do i change .java to .class
By compiling it.
Posts 111 of 11 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?