-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use quicker ban lookup to reduce /seen lag.
- Loading branch information
Showing
4 changed files
with
45 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Essentials/src/com/earth2me/essentials/craftbukkit/BanLookup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.earth2me.essentials.craftbukkit; | ||
|
||
import com.earth2me.essentials.User; | ||
import java.util.Iterator; | ||
import java.util.Set; | ||
import net.ess3.api.IEssentials; | ||
import org.bukkit.BanEntry; | ||
import org.bukkit.BanList; | ||
|
||
|
||
public class BanLookup | ||
{ | ||
public static Boolean isBanned(IEssentials ess, User user) | ||
{ | ||
return isBanned(ess, user.getName()); | ||
} | ||
|
||
public static Boolean isBanned(IEssentials ess, String name) | ||
{ | ||
return getBanEntry(ess, name) != null; | ||
} | ||
|
||
public static BanEntry getBanEntry(IEssentials ess, String name) | ||
{ | ||
Set<BanEntry> benteries = ess.getServer().getBanList(BanList.Type.NAME).getBanEntries(); | ||
for (BanEntry banEnt : benteries) | ||
{ | ||
if (banEnt.getTarget().equals(name)) | ||
{ | ||
return banEnt; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters