Java Reference
In-Depth Information
player_name — a string, and a primary key, just like we used in the Location-
Snapshot plugin.
location_strings — a list of strings. To make a list for a field, add the param-
eter isList = true to the annotation, and make the variable a list of strings:
ArrayList<String> instead of just a plain String .
Give that a try now. You should end up with something that looks like this:
@Column(columnName = "player_name" ,
columnType = Column.ColumnType.PRIMARY,
dataType = DataType.STRING)
public String player_name;
@Column(columnName = "location_strings" ,
dataType = DataType.STRING,
isList = true)
public ArrayList < String > location_strings;
You need two more things before this piece of code will even compile, just like
we did up in the SavedLocation plugin:
•Add a default constructor that supplies a name for this table in the
database (let's call it "saved_player_locations" )
•Add a function named getInstance that returns a new one of these as a
DataAccess object.
•Add one extra thing: a constructor that takes a string for the player name.
In the body of the constructor, you'll need to call super just like in the
default constructor, then make the assignment to player_name .
When you're all done, it should like something like this:
public SavedLocation() {
super( "saved_player_locations" );
public SavedLocation( String name) {
super( "saved_player_locations" );
player_name = name;
public DataAccess getInstance() {
return new SavedLocation();
Make sure that much compiles, using as usual.
Search WWH ::

Custom Search