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:
12
src/com/massivecraft/factions/mixin/PowerMixin.java
Normal file
12
src/com/massivecraft/factions/mixin/PowerMixin.java
Normal 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);
|
||||
}
|
49
src/com/massivecraft/factions/mixin/PowerMixinDefault.java
Normal file
49
src/com/massivecraft/factions/mixin/PowerMixinDefault.java
Normal 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;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user