Add mcmmo boostertypes
This commit is contained in:
parent
2c0d255219
commit
f3921da22b
|
|
@ -6,7 +6,23 @@ public enum BoosterType {
|
|||
* MCMMO - implies all mcmmo skills are boosted
|
||||
*/
|
||||
MCMMO("mcmmo"),
|
||||
// TODO : add individual mcmmo skills
|
||||
|
||||
ACROBATICS("acrobatics"),
|
||||
ALCHEMY("alchemy"),
|
||||
ARCHERY("archery"),
|
||||
AXES("axes"),
|
||||
EXCAVATION("excavation"),
|
||||
FISHING("fishing"),
|
||||
HERBALISM("herbalism"),
|
||||
MINING("mining"),
|
||||
REPAIR("repair"),
|
||||
SALVAGE("salvage"),
|
||||
SMELTING("smelting"),
|
||||
SWORDS("swords"),
|
||||
TAMING("taming"),
|
||||
UNARMED("unarmed"),
|
||||
WOODCUTTING("woodcutting"),
|
||||
|
||||
/**
|
||||
* MYPET - Boosts MyPet exp gains
|
||||
*/
|
||||
|
|
@ -33,7 +49,7 @@ public enum BoosterType {
|
|||
*/
|
||||
UNKNOWN("unknown");
|
||||
|
||||
public String BoosterName;
|
||||
public final String BoosterName;
|
||||
BoosterType(String BoosterName) {
|
||||
this.BoosterName = BoosterName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ plugins {
|
|||
`java-library`
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "7.1.0"
|
||||
id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
plugins {
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("net.minecrell.plugin-yml.bukkit")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
@ -28,3 +29,11 @@ tasks {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
bukkit {
|
||||
name = rootProject.name
|
||||
main = "$group.BoostersPlugin"
|
||||
apiVersion = "1.18"
|
||||
authors = listOf("destro174")
|
||||
softDepend = listOf("MyPet", "mcMMO")
|
||||
}
|
||||
|
|
@ -23,12 +23,15 @@ public final class BoostersPlugin extends JavaPlugin {
|
|||
instance = this;
|
||||
boosterAPI = new BoosterImplementation();
|
||||
boosterManager = new BoosterManager();
|
||||
|
||||
if (getServer().getPluginManager().isPluginEnabled("MyPet")) {
|
||||
registerListener(new MyPetListener());
|
||||
}
|
||||
|
||||
if (getServer().getPluginManager().isPluginEnabled("mcMMO")) {
|
||||
registerListener(new MCmmoListener());
|
||||
}
|
||||
|
||||
registerListener(new PhantomSpawnListener());
|
||||
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, Config.pluginMessageChannel);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ public class Booster implements com.alttd.boosterapi.Booster {
|
|||
this(UUID.randomUUID(), type, playerName, duration, multiplier);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,19 @@ public class MCmmoListener implements Listener {
|
|||
@EventHandler
|
||||
public void onMcMMOExperienceEvent(McMMOPlayerXpGainEvent event) {
|
||||
BoosterManager bm = BoostersPlugin.getInstance().getBoosterManager();
|
||||
if(bm.isBoosted(BoosterType.MCMMO)) {
|
||||
Booster b = bm.getBoosted(BoosterType.MCMMO);
|
||||
if (bm.isBoosted(BoosterType.MCMMO)) {
|
||||
Booster b = bm.getBooster(BoosterType.MCMMO);
|
||||
int multiplier = b.getMultiplier();
|
||||
event.setRawXpGained(event.getRawXpGained() * multiplier);
|
||||
return;
|
||||
}
|
||||
String skillName = event.getSkill().name();
|
||||
BoosterType type = BoosterType.getByName(skillName);
|
||||
if (bm.isBoosted(type)) {
|
||||
Booster b = bm.getBooster(type);
|
||||
int multiplier = b.getMultiplier();
|
||||
event.setRawXpGained(event.getRawXpGained() * multiplier);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// TODO : add individual mcmmo skill boosters
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class MyPetListener implements Listener {
|
|||
public void onMyPetExpEvent(MyPetExpEvent event) {
|
||||
BoosterManager bm = BoostersPlugin.getInstance().getBoosterManager();
|
||||
if(bm.isBoosted(BoosterType.MYPET)) {
|
||||
Booster b = bm.getBoosted(BoosterType.MYPET);
|
||||
Booster b = bm.getBooster(BoosterType.MYPET);
|
||||
int multiplier = b.getMultiplier();
|
||||
event.setExp(event.getExp() * multiplier);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class BoosterManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
public Booster getBoosted(BoosterType type) {
|
||||
public Booster getBooster(BoosterType type) {
|
||||
for (Booster b : activeBoosters) {
|
||||
if (b.getType() == type && b.isActive()) {
|
||||
return b;
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
# we can have gradle generate this file
|
||||
name: BoosterPlugin
|
||||
version: 1.0 # TODO version from gradle
|
||||
main: com.alttd.boosters.BoosterPlugin
|
||||
api-version: 1.17
|
||||
load: STARTUP
|
||||
authors: [Destro, Teriuihi]
|
||||
Loading…
Reference in New Issue
Block a user