Skip to content

Commit

Permalink
clean events for compat with new core
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 29, 2020
1 parent 2d59254 commit ad653dd
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 17 deletions.
Expand Up @@ -30,7 +30,6 @@ public void process(ByteBuf data) {
@Override
public void run() {
BungeeBridge.instance.knownServers.add(serverName);
BungeeServerConnectScriptEvent.instance.reset();
BungeeServerConnectScriptEvent.instance.serverName = serverName;
BungeeServerConnectScriptEvent.instance.fire();
}
Expand Down
Expand Up @@ -34,7 +34,6 @@ public void process(ByteBuf data) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Depenizen.instance, new Runnable() {
@Override
public void run() {
BungeePlayerJoinsScriptEvent.instance.reset();
BungeePlayerJoinsScriptEvent.instance.name = name;
BungeePlayerJoinsScriptEvent.instance.uuid = uuid;
BungeePlayerJoinsScriptEvent.instance.fire();
Expand Down
Expand Up @@ -34,7 +34,6 @@ public void process(ByteBuf data) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Depenizen.instance, new Runnable() {
@Override
public void run() {
BungeePlayerQuitsScriptEvent.instance.reset();
BungeePlayerQuitsScriptEvent.instance.name = name;
BungeePlayerQuitsScriptEvent.instance.uuid = uuid;
BungeePlayerQuitsScriptEvent.instance.fire();
Expand Down
Expand Up @@ -40,7 +40,6 @@ public void process(ByteBuf data) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Depenizen.instance, new Runnable() {
@Override
public void run() {
BungeePlayerServerSwitchScriptEvent.instance.reset();
BungeePlayerServerSwitchScriptEvent.instance.name = name;
BungeePlayerServerSwitchScriptEvent.instance.uuid = uuid;
BungeePlayerServerSwitchScriptEvent.instance.newServer = serverName;
Expand Down
Expand Up @@ -37,7 +37,6 @@ public void process(ByteBuf data) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Depenizen.instance, new Runnable() {
@Override
public void run() {
BungeeProxyServerCommandScriptEvent.instance.reset();
BungeeProxyServerCommandScriptEvent.instance.sender = sender;
BungeeProxyServerCommandScriptEvent.instance.command = command;
BungeeProxyServerCommandScriptEvent.instance.fire();
Expand Down
Expand Up @@ -46,7 +46,6 @@ public void process(ByteBuf data) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Depenizen.instance, new Runnable() {
@Override
public void run() {
BungeeProxyServerListPingScriptEvent.instance.reset();
BungeeProxyServerListPingScriptEvent.instance.address = address;
BungeeProxyServerListPingScriptEvent.instance.currentPlayers = currentPlayers;
BungeeProxyServerListPingScriptEvent.instance.maxPlayers = maxPlayers;
Expand Down
Expand Up @@ -30,7 +30,6 @@ public void process(ByteBuf data) {
@Override
public void run() {
BungeeBridge.instance.knownServers.remove(serverName);
BungeeServerDisconnectScriptEvent.instance.reset();
BungeeServerDisconnectScriptEvent.instance.serverName = serverName;
BungeeServerDisconnectScriptEvent.instance.fire();
}
Expand Down
Expand Up @@ -67,6 +67,7 @@ public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
return false;
}
new_mana = mana.asInt();
event.setNewAmount(new_mana);
}
return super.applyDetermination(path, determinationObj);
}
Expand Down Expand Up @@ -102,6 +103,5 @@ public void onPlayerCastsSpell(ManaChangeEvent event) {
reason = new ElementTag(event.getReason().name());
this.event = event;
fire(event);
event.setNewAmount(new_mana);
}
}
Expand Up @@ -75,6 +75,7 @@ public String getName() {
public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
if (determinationObj instanceof ElementTag && ((ElementTag) determinationObj).isFloat()) {
xp = (ElementTag) determinationObj;
event.setRawXpGained(xp.asFloat());
return true;
}
return super.applyDetermination(path, determinationObj);
Expand Down Expand Up @@ -110,6 +111,5 @@ public void onmcMMOPlayerLevelChanges(McMMOPlayerXpGainEvent event) {
xp = new ElementTag(event.getRawXpGained());
this.event = event;
fire(event);
event.setRawXpGained(xp.asFloat());
}
}
Expand Up @@ -79,6 +79,7 @@ public String getName() {
public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
if (determinationObj instanceof ElementTag && ((ElementTag) determinationObj).isInt()) {
levels_lost = ((ElementTag) determinationObj).asInt();
event.setLevelsLost(levels_lost);
return true;
}
return super.applyDetermination(path, determinationObj);
Expand Down Expand Up @@ -121,6 +122,5 @@ public void onmcMMOPlayerLevelDown(McMMOPlayerLevelDownEvent event) {
skill = new ElementTag(event.getSkill().getName());
this.event = event;
fire(event);
event.setLevelsLost(levels_lost);
}
}
Expand Up @@ -80,6 +80,7 @@ public String getName() {
public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
if (determinationObj instanceof ElementTag && ((ElementTag) determinationObj).isInt()) {
levels_gained = ((ElementTag) determinationObj).asInt();
event.setLevelsGained(levels_gained);
return true;
}
return super.applyDetermination(path, determinationObj);
Expand Down Expand Up @@ -122,6 +123,5 @@ public void onmcMMOPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
skill = new ElementTag(event.getSkill().getName());
this.event = event;
fire(event);
event.setLevelsGained(levels_gained);
}
}
Expand Up @@ -109,10 +109,12 @@ public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
Argument arg = new Argument(determination);
if (arg.matchesPrefix("currency") && arg.matchesFloat()) {
currency = new ElementTag(determination);
event.setCurrency(currency.asDouble());
return true;
}
else if (ArgumentHelper.matchesInteger(determination)) { // "xp" prefix, but not required for back support reasons.
experience = new ElementTag(determination);
event.setExp(experience.asInt());
return true;
}
else if (Argument.valueOf(determination).matchesArgumentList(ItemTag.class)) {
Expand All @@ -123,6 +125,9 @@ else if (Argument.valueOf(determination).matchesArgumentList(ItemTag.class)) {
for (ItemTag i : items) {
newDrops.add(i.getItemStack());
}
if (newDrops != null && !newDrops.isEmpty()) {
event.setDrops(newDrops);
}
return true;
}
}
Expand Down Expand Up @@ -176,11 +181,6 @@ public void onMythicMobDeath(MythicMobDeathEvent event) {
newDrops = null;
this.event = event;
fire(event);
if (newDrops != null && !newDrops.isEmpty()) {
event.setDrops(newDrops);
}
event.setExp(experience.asInt());
event.setCurrency(currency.asDouble());
EntityTag.forgetEntity(entity.getBukkitEntity());
}
}
Expand Up @@ -135,7 +135,7 @@ public Town getTown() {
return town;
}

public Boolean equals(TownTag town) {
public boolean equals(TownTag town) {
return CoreUtilities.toLowerCase(town.getTown().getName()).equals(CoreUtilities.toLowerCase(this.getTown().getName()));
}

Expand Down

0 comments on commit ad653dd

Please sign in to comment.