Browse files

add event for repeat call event

  • Loading branch information...
1 parent 52b3340 commit 409e136df3eead82f7f167acbfcc1d58d94a5965 @inorixu inorixu committed Mar 27, 2012
Showing with 22 additions and 2 deletions.
  1. +22 −2 src/com/inori/utils/ILog.java
View
24 src/com/inori/utils/ILog.java
@@ -1,8 +1,10 @@
package com.inori.utils;
+import java.util.HashMap;
import java.util.logging.Logger;
import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerMoveEvent;
import com.bekvon.bukkit.residence.Residence;
@@ -16,13 +18,31 @@
private static Logger logger;
private static String PREFIX = "[Residence] ";
- private static Boolean enable = false;
+ private static Boolean enable = true;
static {
logger = Residence.getServ().getLogger();
//logger.setLevel(Level.INFO);
}
-
+
+ private static HashMap<PlayerMoveEvent, Integer> counter = new HashMap<PlayerMoveEvent, Integer>();
+ public static void repeatCallEvent(PlayerMoveEvent event) {
+ if(counter.containsKey(event))
+ {
+ Integer i = counter.get(event);
+ i++;
+ if(i < 100){
+ counter.put(event, i);
+ Residence.getServ().getPluginManager().callEvent(event);
+ }
+ else
+ return;
+ }else{
+ counter.put(event, 0);
+ Residence.getServ().getPluginManager().callEvent(event);
+ }
+ }
+
public static void log(String msg)
{
if(enable)

0 comments on commit 409e136

Please sign in to comment.