Add in lazy option without implementing it.

This commit is contained in:
Olof Larsson 2013-10-18 14:50:12 +02:00
parent 03c2d8b6a1
commit e630d509ed
5 changed files with 24 additions and 19 deletions

View File

@ -5,7 +5,6 @@ import java.util.Map;
import org.bukkit.permissions.Permissible; import org.bukkit.permissions.Permissible;
import com.massivecraft.mcore.MCore;
import com.massivecraft.mcore.store.Entity; import com.massivecraft.mcore.store.Entity;
import com.massivecraft.mcore.util.MUtil; import com.massivecraft.mcore.util.MUtil;
import com.massivecraft.mcore.util.PermUtil; import com.massivecraft.mcore.util.PermUtil;
@ -16,10 +15,8 @@ public class MCoreConf extends Entity<MCoreConf>
// META // META
// -------------------------------------------- // // -------------------------------------------- //
public static MCoreConf get() protected static transient MCoreConf i;
{ public static MCoreConf get() { return i; }
return MCoreConfColl.get().get(MCore.INSTANCE);
}
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE

View File

@ -14,7 +14,7 @@ public class MCoreConfColl extends Coll<MCoreConf>
public static MCoreConfColl get() { return i; } public static MCoreConfColl get() { return i; }
private MCoreConfColl() private MCoreConfColl()
{ {
super("mcore_conf", MCoreConf.class, MStore.getDb(ConfServer.dburi), MCore.get(), true, false); super("mcore_conf", MCoreConf.class, MStore.getDb(ConfServer.dburi), MCore.get());
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -25,7 +25,7 @@ public class MCoreConfColl extends Coll<MCoreConf>
public void init() public void init()
{ {
super.init(); super.init();
this.get(MCore.INSTANCE); MCoreConf.i = this.get(MCore.INSTANCE, true);
} }
@Override @Override

View File

@ -153,7 +153,11 @@ public class Coll<E> implements CollInterface<E>
// -------------------------------------------- // // -------------------------------------------- //
// BEHAVIOR // BEHAVIOR
// -------------------------------------------- // // -------------------------------------------- //
protected boolean lazy;
@Override public boolean isLazy() { return this.lazy; }
@Override public void setLazy(boolean lazy) { this.lazy = lazy; }
protected boolean creative; protected boolean creative;
@Override public boolean isCreative() { return this.creative; } @Override public boolean isCreative() { return this.creative; }
@Override public void setCreative(boolean creative) { this.creative = creative; } @Override public void setCreative(boolean creative) { this.creative = creative; }
@ -754,7 +758,7 @@ public class Coll<E> implements CollInterface<E>
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public Coll(String name, Class<E> entityClass, Db db, Plugin plugin, boolean creative, boolean lowercasing, Comparator<? super String> idComparator, Comparator<? super E> entityComparator) public Coll(String name, Class<E> entityClass, Db db, Plugin plugin, boolean lazy, boolean creative, boolean lowercasing, Comparator<? super String> idComparator, Comparator<? super E> entityComparator)
{ {
// Setup the name and the parsed parts // Setup the name and the parsed parts
this.name = name; this.name = name;
@ -771,6 +775,7 @@ public class Coll<E> implements CollInterface<E>
// WHAT DO WE HANDLE? // WHAT DO WE HANDLE?
this.entityClass = entityClass; this.entityClass = entityClass;
this.lazy = lazy;
this.creative = creative; this.creative = creative;
this.lowercasing = lowercasing; this.lowercasing = lowercasing;
@ -800,14 +805,14 @@ public class Coll<E> implements CollInterface<E>
}; };
} }
public Coll(String name, Class<E> entityClass, Db db, Plugin plugin, boolean creative, boolean lowercasing) public Coll(String name, Class<E> entityClass, Db db, Plugin plugin, boolean lazy, boolean creative, boolean lowercasing)
{ {
this(name, entityClass, db, plugin, creative, lowercasing, null, null); this(name, entityClass, db, plugin, lazy, creative, lowercasing, null, null);
} }
public Coll(String name, Class<E> entityClass, Db db, Plugin plugin) public Coll(String name, Class<E> entityClass, Db db, Plugin plugin)
{ {
this(name, entityClass, db, plugin, false, false); this(name, entityClass, db, plugin, false, false, false);
} }
@Override @Override

View File

@ -52,11 +52,14 @@ public interface CollInterface<E>
// BEHAVIOR // BEHAVIOR
// -------------------------------------------- // // -------------------------------------------- //
public boolean isLazy();
public void setLazy(boolean lazy);
public boolean isCreative(); public boolean isCreative();
public void setCreative(boolean val); public void setCreative(boolean creative);
public boolean isLowercasing(); public boolean isLowercasing();
public void setLowercasing(boolean val); public void setLowercasing(boolean lowercasing);
// A default entity will not be saved. // A default entity will not be saved.
// This is often used together with creative collections to save disc space. // This is often used together with creative collections to save disc space.

View File

@ -25,19 +25,19 @@ public class SenderColl<E extends SenderEntity<E>> extends Coll<E> implements Se
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public SenderColl(String name, Class<E> entityClass, Db db, Plugin plugin, boolean creative, boolean lowercasing, Comparator<? super String> idComparator, Comparator<? super E> entityComparator) public SenderColl(String name, Class<E> entityClass, Db db, Plugin plugin, boolean lazy, boolean creative, boolean lowercasing, Comparator<? super String> idComparator, Comparator<? super E> entityComparator)
{ {
super(name, entityClass, db, plugin, creative, lowercasing, idComparator, entityComparator); super(name, entityClass, db, plugin, lazy, creative, lowercasing, idComparator, entityComparator);
} }
public SenderColl(String name, Class<E> entityClass, Db db, Plugin plugin, boolean creative, boolean lowercasing) public SenderColl(String name, Class<E> entityClass, Db db, Plugin plugin, boolean lazy, boolean creative, boolean lowercasing)
{ {
super(name, entityClass, db, plugin, creative, lowercasing); super(name, entityClass, db, plugin, lazy, creative, lowercasing);
} }
public SenderColl(String name, Class<E> entityClass, Db db, Plugin plugin) public SenderColl(String name, Class<E> entityClass, Db db, Plugin plugin)
{ {
super(name, entityClass, db, plugin, true, true); super(name, entityClass, db, plugin, true, true, true);
} }
// -------------------------------------------- // // -------------------------------------------- //