We need UConf as well as MConf.

This commit is contained in:
Olof Larsson 2013-04-22 16:26:44 +02:00
parent 26fa7e8b95
commit 6d2db1930c
6 changed files with 115 additions and 22 deletions

View File

@ -5,10 +5,6 @@ website: http://massivecraft.com/factions
authors: [Olof "Cayorion" Larsson, Brett Flannigan]
depend: [mcore]
softdepend: [PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag]
commands:
factions:
description: The Factions base command
aliases: [f]
permissions:
# -------------------------------------------- #
# THE REAL NODES

View File

@ -16,10 +16,7 @@ public class MConf extends Entity<MConf>
// -------------------------------------------- //
protected static transient MConf i;
public static MConf get()
{
return i;
}
public static MConf get() { return i; }
// -------------------------------------------- //
// COLORS

View File

@ -0,0 +1,22 @@
package com.massivecraft.factions.entity;
import com.massivecraft.mcore.store.Entity;
public class UConf extends Entity<UConf>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
public static UConf get(Object worldNameExtractable)
{
return UConfColls.get().get2(worldNameExtractable);
}
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
}

View File

@ -0,0 +1,32 @@
package com.massivecraft.factions.entity;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions;
import com.massivecraft.mcore.MCore;
import com.massivecraft.mcore.store.Coll;
import com.massivecraft.mcore.store.MStore;
public class UConfColl extends Coll<UConf>
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public UConfColl(String name)
{
super(name, UConf.class, MStore.getDb(ConfServer.dburi), Factions.get(), true, false);
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void init()
{
super.init();
this.get(MCore.INSTANCE);
}
}

View File

@ -0,0 +1,49 @@
package com.massivecraft.factions.entity;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.Factions;
import com.massivecraft.mcore.MCore;
import com.massivecraft.mcore.store.Colls;
import com.massivecraft.mcore.usys.Aspect;
public class UConfColls extends Colls<UConfColl, UConf>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static UConfColls i = new UConfColls();
public static UConfColls get() { return i; }
// -------------------------------------------- //
// OVERRIDE: COLLS
// -------------------------------------------- //
@Override
public UConfColl createColl(String collName)
{
return new UConfColl(collName);
}
@Override
public Aspect getAspect()
{
return Factions.get().getAspect();
}
@Override
public String getBasename()
{
return Const.COLLECTION_BASENAME_UCONF;
}
@Override
public UConf get2(Object worldNameExtractable)
{
UConfColl coll = this.get(worldNameExtractable);
if (coll == null) return null;
return coll.get(MCore.INSTANCE);
}
}

View File

@ -178,23 +178,20 @@ public class TodoFactionsPlayerListener implements Listener
Block block = event.getBlockClicked();
Player player = event.getPlayer();
if ( ! playerCanUseItemHere(player, PS.valueOf(block), event.getBucket(), false))
{
if (playerCanUseItemHere(player, PS.valueOf(block), event.getBucket(), false)) return;
event.setCancelled(true);
return;
}
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketFill(PlayerBucketFillEvent event)
{
Block block = event.getBlockClicked();
Player player = event.getPlayer();
if ( ! playerCanUseItemHere(player, PS.valueOf(block), event.getBucket(), false))
{
if (playerCanUseItemHere(player, PS.valueOf(block), event.getBucket(), false)) return;
event.setCancelled(true);
return;
}
}