Would you like to react to this message? Create an account in a few clicks or log in to continue.

Official Community Forums
 
HomeHome  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  The Wiki  Website  github Project  

 

 Setting up Eclipse

Go down 
2 posters
AuthorMessage
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Setting up Eclipse Empty
PostSubject: Setting up Eclipse   Setting up Eclipse EmptySun 13 Nov - 10:52

I've been following the Wiki tutorial to set up Eclipse , so that I can develop the Faction plugin.


However, I'm having some issues with warnings on many java files, that are not letting me export the JAR to overwrite the original mars.jar file.

Bascially, there are lots of warnings (34 in fact) associated with the files, and when I try to export, 18 of them throw up errors.
Here's an example:


Quote :

Class files on classpath not found or not accessible for 'Glory of Rome/src/multiverse/mars/events/QuestStatusChanged.java

Then the rest of the errors start with
Quote :

Exported with compile warnings.... (directory then the .java file)



Now, I looked at the offending Java files, and there is a common problem with some) of them.
Here's an example in AbstractDeathListener.java

Code:

public abstract class AbstractDeathListener extends AbstractEventListener {

There is a warning icon next to it, that says:
Quote :

The serializable class AbstractDeathListener does not declare a static final serialVersionUID field of type long

It's given me some options, the first of which is adding a default serial version ID, and the second is adding a generated serial version ID.


What am I supposed to do? Shall I just add a generated serial version ID?
Back to top Go down
http://www.3dmodeller.info
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Setting up Eclipse Empty
PostSubject: Re: Setting up Eclipse   Setting up Eclipse EmptySun 13 Nov - 11:17

Also, I've tried to sort out the core/DCMap.java file, but with no luck.

Apparently there's something wrong with the this piece of code

Code:

HashMap<DisplayContext, DisplayContext> unmarshalHashMap2 = (HashMap<DisplayContext, DisplayContext>)MarshallingRuntime.unmarshalHashMap(buf);
         HashMap<DisplayContext, DisplayContext> unmarshalHashMap = unmarshalHashMap2;
         map = unmarshalHashMap;

in DCMap.java:

Code:

package multiverse.mars.core;

import java.util.*;
import java.io.*;
import java.util.concurrent.locks.*;
import multiverse.server.util.*;
import multiverse.server.objects.*;
import multiverse.server.marshalling.*;
import multiverse.server.network.*;

/**
 * maps a base DC to an item specific DC
 * you have an item like a leather tunic, and you
 * want to put that on a human female.  which meshes do you use?
 * this maps from a base dc (like human_female.mesh and the nude submeshes)
 * to the dc you should use for the item, such as
 * human_female_tunic.mesh
 *
 * at some point we want to add 'state' like whether you are in combat or not
 * and also equipslot into the mix
 */
public class DCMap implements Serializable, Marshallable {

    public DCMap() {
    }

    public void add(DisplayContext base, DisplayContext target) {
   lock.lock();
   try {
       map.put(base, target);
   }
   finally {
       lock.unlock();
   }
    }

    /**
    * returns corresponding DC.  if there is none,
    * this method will return the defaultDC (possibly null)
    * there is a match when the map has an entry that is a
    * subset of the passed in base (not the other way around).
    * usually the base of a mob has a head and other parts which
    * we should disregard
    */
    public DisplayContext get(DisplayContext base) {
   lock.lock();
   try {
       // trivial case - exact match
       DisplayContext dc = map.get(base);
       if (dc != null) {
      return dc;
       }
      
       // subset match
       for (Map.Entry<DisplayContext, DisplayContext> entry :
          map.entrySet()) {
      DisplayContext key = entry.getKey();
      if (key.subsetOf(base)) {
          return entry.getValue();
      }
       }

       // default match
       return defaultDC;
   }
   finally {
       lock.unlock();
   }
    }

    /**
    * sometimes you want to set a default mapping.
    * this is used when there is no match for the base model.
    * this is useful when you have an item that is always the same
    * regardless of the base mesh
    */
    public DisplayContext getDefault() {
   return defaultDC;
    }
    public void setDefault(DisplayContext dc) {
   this.defaultDC = dc;
    }

    // for java beans xml serialization support
    public Map<DisplayContext, DisplayContext> getMap() {
   lock.lock();
   try {
       return new HashMap<DisplayContext,DisplayContext>(map);
   }
   finally {
       lock.unlock();
   }
    }
    public void setMap(Map<DisplayContext, DisplayContext> map) {
   lock.lock();
   try {
       this.map = new HashMap<DisplayContext,DisplayContext>(map);
   }
   finally {
       lock.unlock();
   }
    }

    public void marshalObject(MVByteBuffer buf) {
        byte flags = (byte)((defaultDC == null ? 0 : 1) | (map == null ? 0 : 2));
        buf.putByte(flags);
        if (defaultDC != null)
            MarshallingRuntime.marshalMarshallingObject(buf, defaultDC);
        if (map != null)
            MarshallingRuntime.marshalHashMap(buf, map);
    }

    public Object unmarshalObject(MVByteBuffer buf) {
        byte flags = buf.getByte();
        if ((flags & 1) != 0) {
            MarshallingRuntime.unmarshalMarshallingObject(buf, defaultDC);
        }
        if ((flags & 2) != 0) {
          HashMap<DisplayContext, DisplayContext> unmarshalHashMap2 = (HashMap<DisplayContext, DisplayContext>)MarshallingRuntime.unmarshalHashMap(buf);
         HashMap<DisplayContext, DisplayContext> unmarshalHashMap = unmarshalHashMap2;
         map = unmarshalHashMap;
        }
        return this;
    }

    DisplayContext defaultDC;
    Map<DisplayContext, DisplayContext> map =
   new HashMap<DisplayContext, DisplayContext>();
    Lock lock = LockFactory.makeLock("DCMap");
    private static final long serialVersionUID = 1L;
}

Any idea what's wrong?

The weird thing is, I haven't even modified these files before. They are exactly the same as when I downloaded it, so we clearly need to update the base java code!
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Setting up Eclipse Empty
PostSubject: Re: Setting up Eclipse   Setting up Eclipse EmptyWed 16 Nov - 2:23

I moved this to Server development and QuestStatusChanged has always been broken at least for me I have always just deselected when exporting to jar. I should take a look at what went wrong.
For the serial id if you want to try to keep track of what version everything is you can but I generally just set it to 1L (a long 1)

I havent tried to package the server yet so I have not run into the problem with DCMap but it looks like it compiles fine with ant. When you created the project did you load it from the ant file?
Back to top Go down
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Setting up Eclipse Empty
PostSubject: Re: Setting up Eclipse   Setting up Eclipse EmptyWed 16 Nov - 3:33

Good idea!

To be honest, quests won't really be a part of my project, so I guess I can just deselect that for now. Won't do any harm.

And yes, I believe I did load the project from the ant file.

Any idea what's wrong with the DCMap file?

Because I've got the same issue with Plugins/ClassAbilityPlugin.java

Code:

if(xpUpdateMsg.getProperty("attackers") != null){ 
           
            CombatInfo target = CombatPlugin.getCombatInfo(xpUpdateMsg.getSubject());
            Set<Long> attackers = (HashSet<Long>)xpUpdateMsg.getProperty("attackers");
            handlePlayerXP(target, attackers);
        }
       
        return true;
       }

There's an error on the
Code:

(HashSet<Long>)xpUpdateMsg.getProperty("attackers")
part, and the popup says "Type safety: Unchecked cast from Serializable to HashSet<Long>"





The next one is in Plugins/CombatPlugin

Code:

public void onLoad(Entity e) {
       CombatInfo info = (CombatInfo) e;
       Map<String, EffectState> effectMap = (Map<String, EffectState>)info.getProperty("regenEffectMap");
       if (effectMap != null) {
      regenMap.put(info, effectMap);
       }
       for (EffectState state : info.getEffects()) {
      state.resume();
       }
   }
    }

It says that "(Map<String, EffectState>)info.getProperty("regenEffectMap")" has this error:
"Type safety: Unchecked cast from Serializable to Map<String,MarsEffect.EffectState"



I could list every single one, but that would take a long time. Perhaps you could look at the original code?
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Setting up Eclipse Empty
PostSubject: Re: Setting up Eclipse   Setting up Eclipse EmptyWed 16 Nov - 4:09

There appears to be a lot of unchecked casting in the server...I wouldn't really worry about them. Is it refusing to output because of that error? It should only be a warning.
Back to top Go down
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Setting up Eclipse Empty
PostSubject: Re: Setting up Eclipse   Setting up Eclipse EmptyWed 16 Nov - 4:19

Yeh, I think most of them are unchecked casts.

I'm not sure if it'll work if I try to export now, I'll give it a try.


I just exported, and overwrote the mar.jar file (I did back it up before though), and I get a dialog that says "JAR export finished with warnings. See details for additional information.

The Wiki says that this will appear, so I assume that it means it's been exported properly?
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Setting up Eclipse Empty
PostSubject: Re: Setting up Eclipse   Setting up Eclipse EmptyWed 16 Nov - 4:45

Yes that is normal...you should be able to start the server with out trouble
Back to top Go down
Tristan
Administrator
Administrator
Tristan


Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

Setting up Eclipse Empty
PostSubject: Re: Setting up Eclipse   Setting up Eclipse EmptyWed 16 Nov - 4:58

Great!

Now I just need to work out how to develop plugins - the Wiki is very confusing!
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development
avatar


Posts : 424
Join date : 2011-08-03

Setting up Eclipse Empty
PostSubject: Re: Setting up Eclipse   Setting up Eclipse EmptyWed 16 Nov - 5:54

Its kind of a confusing process mainly because there is a lot that needs to be done.

Back to top Go down
Sponsored content





Setting up Eclipse Empty
PostSubject: Re: Setting up Eclipse   Setting up Eclipse Empty

Back to top Go down
 
Setting up Eclipse
Back to top 
Page 1 of 1
 Similar topics
-
» Setting up on windows
» setting up server
» Setting up the login page/patcher.
» Setting Up Multiverse On Ubuntu Server 12.04.1 -----> Repost
» Eclipse and Server project

Permissions in this forum:You cannot reply to topics in this forum
 :: Development :: Server Scripting and Development-
Jump to: