mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Changed the way events are raised to prevent variable corruption.
This commit is contained in:
parent
69847af08a
commit
3aba996e97
4 changed files with 26 additions and 26 deletions
|
@ -92,4 +92,5 @@ v 1.8:
|
||||||
- Fixed 'manucheckp' returning a null for the searched node when it's a group/subgroup.
|
- Fixed 'manucheckp' returning a null for the searched node when it's a group/subgroup.
|
||||||
- manpromote and mandemote now correctly send the notification to the console if the command was issued there.
|
- manpromote and mandemote now correctly send the notification to the console if the command was issued there.
|
||||||
- Expanded GlobalGroups.yml and Groups.yml to include Towny permissions.
|
- Expanded GlobalGroups.yml and Groups.yml to include Towny permissions.
|
||||||
- Delayed GroupManager events so Superperms will be fully updated before plugins receive the events.
|
- Delayed GroupManager events so Superperms will be fully updated before plugins receive the events.
|
||||||
|
- Changed the way events are raised to prevent variable corruption.
|
|
@ -1837,25 +1837,6 @@ public class GroupManager extends JavaPlugin {
|
||||||
return match;
|
return match;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Triggers all GroupManager events for other plugins to see.
|
|
||||||
* Schedules events for 1 tick later to allow GM to finish populating super perms.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
public static void callEvent(final GroupManagerEvent event) {
|
|
||||||
|
|
||||||
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
}
|
|
||||||
}) == -1)
|
|
||||||
GroupManager.logger.warning("Could not schedule GM Event.");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the config
|
* @return the config
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package org.anjocaido.groupmanager.events;
|
package org.anjocaido.groupmanager.events;
|
||||||
|
|
||||||
|
|
||||||
|
import org.anjocaido.groupmanager.GroupManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,10 +15,28 @@ public abstract class GroupManagerEvent extends Event {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 8790362185329926951L;
|
private static final long serialVersionUID = 8790362185329926951L;
|
||||||
|
|
||||||
protected GroupManagerEvent(String name) {
|
protected GroupManagerEvent(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggers all GroupManager events for other plugins to see.
|
||||||
|
* Schedules events for 1 tick later to allow GM to finish populating super perms.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
public void schedule(final GroupManagerEvent event) {
|
||||||
|
|
||||||
|
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
}
|
||||||
|
}, 1) == -1)
|
||||||
|
GroupManager.logger.warning("Could not schedule GM Event.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,11 +1,9 @@
|
||||||
package org.anjocaido.groupmanager.events;
|
package org.anjocaido.groupmanager.events;
|
||||||
|
|
||||||
import org.anjocaido.groupmanager.GroupManager;
|
|
||||||
import org.anjocaido.groupmanager.data.Group;
|
import org.anjocaido.groupmanager.data.Group;
|
||||||
import org.anjocaido.groupmanager.data.User;
|
import org.anjocaido.groupmanager.data.User;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ElgarL
|
* @author ElgarL
|
||||||
*
|
*
|
||||||
|
@ -13,13 +11,13 @@ import org.anjocaido.groupmanager.data.User;
|
||||||
public class GroupManagerEventHandler {
|
public class GroupManagerEventHandler {
|
||||||
|
|
||||||
protected static void callEvent(GMGroupEvent event) {
|
protected static void callEvent(GMGroupEvent event) {
|
||||||
GroupManager.callEvent(event);
|
event.schedule(event);
|
||||||
}
|
}
|
||||||
protected static void callEvent(GMUserEvent event) {
|
protected static void callEvent(GMUserEvent event) {
|
||||||
GroupManager.callEvent(event);
|
event.schedule(event);
|
||||||
}
|
}
|
||||||
protected static void callEvent(GMSystemEvent event) {
|
protected static void callEvent(GMSystemEvent event) {
|
||||||
GroupManager.callEvent(event);
|
event.schedule(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void callEvent(Group group, GMGroupEvent.Action action) {
|
public static void callEvent(Group group, GMGroupEvent.Action action) {
|
||||||
|
|
Loading…
Reference in a new issue