Introducing a power Mixin since Bukkit does not allow permissions for offline players and we want to know for offline players. Servers wanting individual power rules can implement and inject this mixin.

This commit is contained in:
Olof Larsson
2013-04-23 17:01:43 +02:00
parent f802307056
commit 29e05fd54d
9 changed files with 119 additions and 77 deletions

View File

@ -0,0 +1,12 @@
package com.massivecraft.factions.mixin;
import com.massivecraft.factions.entity.UPlayer;
public interface PowerMixin
{
public double getMaxUniversal(UPlayer uplayer);
public double getMax(UPlayer uplayer);
public double getMin(UPlayer uplayer);
public double getPerHour(UPlayer uplayer);
public double getPerDeath(UPlayer uplayer);
}

View File

@ -0,0 +1,49 @@
package com.massivecraft.factions.mixin;
import com.massivecraft.factions.entity.UConf;
import com.massivecraft.factions.entity.UPlayer;
public class PowerMixinDefault implements PowerMixin
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static PowerMixinDefault i = new PowerMixinDefault();
public static PowerMixinDefault get() { return i; }
// -------------------------------------------- //
// OVERRIDE: PowerMixin
// -------------------------------------------- //
@Override
public double getMaxUniversal(UPlayer uplayer)
{
return this.getMax(uplayer);
}
@Override
public double getMax(UPlayer uplayer)
{
return UConf.get(uplayer).powerMax;
}
@Override
public double getMin(UPlayer uplayer)
{
return UConf.get(uplayer).powerMin;
}
@Override
public double getPerHour(UPlayer uplayer)
{
return UConf.get(uplayer).powerPerHour;
}
@Override
public double getPerDeath(UPlayer uplayer)
{
return UConf.get(uplayer).powerPerDeath;
}
}