Updating for 1.3.2 to 1.5.1

Discussion in 'Plugin Development' started by Grave, Mar 24, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Grave

    Hi, So I am actually completely new to making plugins, so I'm updating a plugin from 1.3.2 to 1.5.1 and I would like to know how to fix some of these basic and complicated errors.

    The following errors:

    import net.minecraft.server.EntityPlayer;
    import net.minecraft.server.MobEffect;
    import net.minecraft.server.MobEffectList;
    import net.minecraft.server.NetServerHandler;
    import net.minecraft.server.Packet41MobEffect;
    import net.minecraft.server.Packet42RemoveMobEffect;

    import org.bukkit.craftbukkit.entity.CraftPlayer;


    public HashMap<String, Long> Region = new HashMap();
    public HashMap<String, Long> LeftRegion = new HashMap();
    public HashMap<String, Long> Hide = new HashMap();
    public HashMap<String, Long> Show = new HashMap();
    public HashMap<String, Integer> Releave = new HashMap();
    public HashMap<String, Integer> Releave2 = new HashMap();
    public HashMap<String, Integer> Cancel = new HashMap();



    final CraftPlayer cplr = (CraftPlayer)event.getPlayer();

    cplr.getHandle().netServerHandler.sendPacket(new Packet42RemoveMobEffect(cplr.getEntityId(), new MobEffect(MobEffectList.INVISIBILITY.getId(), 0, 0)));

    cplr.getHandle().netServerHandler.sendPacket(new Packet41MobEffect(cplr.getEntityId(), new MobEffect(MobEffectList.INVISIBILITY.getId(), 0, 0)));

    int taskID = Bukkit.getServer().getScheduler().scheduleAsyncDelayedTask(this, new Runnable() {
    public void run() {
    if (!AntiSpawnCamp.this.isWithinRegion(player, "region")) {
    AntiSpawnCamp.this.LeftRegion.remove(player.getName());
    player.sendMessage(endoftimer);
    cplr.getHandle().netServerHandler.sendPacket(new Packet42RemoveMobEffect(cplr.getEntityId(), new MobEffect(MobEffectList.INVISIBILITY.getId(), 0, 0)));
    AntiSpawnCamp.this.Show.put(player.getName(), null);
    AntiSpawnCamp.this.Releave.remove(player.getName());
    }
    }
    }
    , timer2);

    final CraftPlayer cplr = (CraftPlayer)event.getPlayer();

    cplr.getHandle().netServerHandler.sendPacket(new Packet41MobEffect(cplr.getEntityId(), new MobEffect(MobEffectList.INVISIBILITY.getId(), 0, 0)));


    int taskID2 = getServer().getScheduler().scheduleAsyncDelayedTask(this, new Runnable() {
    public void run() {
    AntiSpawnCamp.this.LeftRegion.remove(player.getName());
    player.sendMessage(endoftimer2);
    cplr.getHandle().netServerHandler.sendPacket(new Packet42RemoveMobEffect(cplr.getEntityId(), new MobEffect(MobEffectList.INVISIBILITY.getId(), 0, 0)));
    AntiSpawnCamp.this.Show.put(player.getName(), null);
    AntiSpawnCamp.this.Releave2.remove(player.getName());
    }
    }
    , timer4);

    As you can tell this is just bit of code that caused error I can provide he full source code if you you like, I'm assuming a lot of this is just outdated and is written diffidently such as entityplayer and stuff. As you can see I am well pure noob to this. If you know ways to fix this stuff please help.
     
  2. Offline

    chasechocolate

    Most of it is within the imports, press CMD/CTRL + shift + I to import everything (in Eclipse).
     
  3. Offline

    Grave

    The issue is I think it's outdated it's not the import part that's broken but the the code seems to be old such as CraftPlayer wich may no longer be used i 1.5.1 or has a new term, thank you for your quick reply.
     
  4. Offline

    chasechocolate

    Well the NMS imports have the version in them. Like "net.minecraft.server.v1_5.<class>".
     
  5. Offline

    gomeow

    to send packet now:
    Code:java
    1. ((CraftPlayer)player).getHandle().playerConnection.sendPacket(Packet p);
     
  6. Offline

    Grave

    Is there an simple way to fix that?
     
  7. Offline

    chaseoes

    You should only use NMS/OBC if you know how and can troubleshoot it yourself.
     
    MrBluebear3 and ferrybig like this.
  8. Offline

    gomeow

    Grave

    for example: just change net.minecraft.server.EntityPlayer to net.minecraft.server.v1_5_R1.EntityPlayer
     
  9. Offline

    Grave

    I get this error: The import net.minecraft.server.v1_5_R1 cannot be resolved

    I said before that I don't know any of this to be honest I'm trying yo update an outdated plugin by updating it's code if I even can.

    Would it be possible for me to get someone to update this plugin for me, the original dev left it at 1.3.2 and hasn't been seen since nov 2012, it would be really nice to have someone take over the plugin, it's http://dev.bukkit.org/server-mods/antispawncamp/

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  10. Offline

    Jake0oo0

    It shouldn't be that hard but I do believe that the All Rights Reserved prevents uploading the plugin even if its updated.
     
  11. Offline

    Grave

    Would I have to make a plugin request then?
     
  12. Offline

    Grave

    Can anyone please update this plugin for me? The author has been offline for nearly a year and I really need this plugin updated I am willing to offer money if it is needed...
     
  13. Offline

    CubieX

    Like Jake0oo0 said, even if the source code was available, it would be illegal to modify and distribute the updated version.

    You could send the author a PM regarding your wish. Perharps he will get an eMail automaticly and answer you if he will update it or provide the source code and his permission to use it.
     
Thread Status:
Not open for further replies.

Share This Page