public class BukkitMethods extends Object implements MethodInterface
Constructor and Description |
---|
BukkitMethods() |
Modifier and Type | Method and Description |
---|---|
boolean |
callChat(Object player)
(see implementation)
|
boolean |
callCMD(Object player,
String cmd)
(see implementation)
|
void |
callPunishmentEvent(Punishment punishment)
Call punishment event.
|
void |
callRevokePunishmentEvent(Punishment punishment,
boolean massClear)
Call revoke punishment event.
|
boolean |
contains(Object file,
String path)
Check whether file contains given path.
|
void |
createMySQLFile(File f)
Create default MySQL file.
|
void |
executeCommand(String cmd)
(see implementation)
|
Boolean |
getBoolean(Object file,
String path)
Get boolean at the given path from the given file.
|
boolean |
getBoolean(Object file,
String path,
boolean def)
Get boolean at the given path from the given file or default if not present.
|
YamlConfiguration |
getConfig()
Get the config.yml file
|
File |
getDataFolder()
Get the data folder for string punishments.
|
String |
getFileName(Object file)
Get file name.
|
String |
getFromUrlJson(String url,
String key)
Request JSON from the
url and extract the key |
Integer |
getInteger(Object file,
String path)
Get integer at the given path from the given file.
|
int |
getInteger(Object file,
String path,
int def)
Get integer at the given path from the given file or default if not present.
|
String |
getInternUUID(Object player)
Get a players uuid based on the intern uuid fetcher.
|
String |
getInternUUID(String player)
Get a players uuid based on the intern uuid fetcher.
|
String |
getIP(Object player)
Get a players ip.
|
String[] |
getKeys(Object file,
String path)
Get key from a config file at a
path . |
YamlConfiguration |
getLayouts()
Get the layouts.yml file
|
Long |
getLong(Object file,
String path)
Get long at the given path from the given file.
|
long |
getLong(Object file,
String path,
long def)
Get long at the given path from the given file or default if not present.
|
YamlConfiguration |
getMessages()
Get the messages.yml file
|
YamlConfiguration |
getMySQLFile()
Get MySQL.yml file.
|
String |
getName(Object player)
Get a players name.
|
String |
getName(String uuid)
Get a players name based on the intern uuid fetcher.
|
Player[] |
getOnlinePlayers()
Get online players.
|
Player |
getPlayer(String name)
Get online player by name.
|
JavaPlugin |
getPlugin()
Get the plugin instance.
|
String |
getString(Object file,
String path)
Get string at the given path from the given file.
|
String |
getString(Object file,
String path,
String def)
Get string at the given path from the given file or default if not present.
|
List<String> |
getStringList(Object file,
String path)
Get string list at the given path from the given file.
|
String |
getVersion()
Get the advanced ban version.
|
boolean |
hasPerms(Object player,
String perms)
Check if player has the given permission.
|
boolean |
isOnline(String name)
Check whether player is online.
|
boolean |
isOnlineMode()
Check whether server is in online mode.
|
boolean |
isUnitTesting()
Whether this instance is used for unit testing.
|
void |
kickPlayer(String player,
String reason)
Kick a player.
|
void |
loadFiles()
Creates and load the different configuration files.
|
void |
loadMySQLFile(File f)
Load MySQL data from file.
|
void |
log(String msg)
Log a message.
|
void |
notify(String perm,
List<String> notification)
Broadcast a message to every user with the given permission.
|
String |
parseJSON(InputStreamReader json,
String key)
Parse json string and retrieve value at given key.
|
String |
parseJSON(String json,
String key)
Parse json string and retrieve value at given key.
|
void |
runAsync(Runnable rn)
Run async task.
|
void |
runSync(Runnable rn)
Run sync task.
|
void |
scheduleAsync(Runnable rn,
long l1)
Schedule async task.
|
void |
scheduleAsyncRep(Runnable rn,
long l1,
long l2)
Schedule async repeating task.
|
void |
sendMessage(Object player,
String msg)
Send a message to a specific player.
|
void |
setCommandExecutor(String cmd)
Register a command name to be handled by advancedban.
|
void |
setupMetrics()
Set up metrics.
|
public void loadFiles()
MethodInterface
loadFiles
in interface MethodInterface
public String getFromUrlJson(String url, String key)
MethodInterface
url
and extract the key
getFromUrlJson
in interface MethodInterface
url
- the urlkey
- the keypublic String getVersion()
MethodInterface
getVersion
in interface MethodInterface
public String[] getKeys(Object file, String path)
MethodInterface
path
.getKeys
in interface MethodInterface
file
- the filepath
- the pathpublic YamlConfiguration getConfig()
MethodInterface
getConfig
in interface MethodInterface
public YamlConfiguration getMessages()
MethodInterface
getMessages
in interface MethodInterface
public YamlConfiguration getLayouts()
MethodInterface
getLayouts
in interface MethodInterface
public void setupMetrics()
MethodInterface
setupMetrics
in interface MethodInterface
public JavaPlugin getPlugin()
MethodInterface
getPlugin
in interface MethodInterface
public File getDataFolder()
MethodInterface
getDataFolder
in interface MethodInterface
public void setCommandExecutor(String cmd)
MethodInterface
setCommandExecutor
in interface MethodInterface
cmd
- the cmdpublic void sendMessage(Object player, String msg)
MethodInterface
sendMessage
in interface MethodInterface
player
- the playermsg
- the msgpublic boolean hasPerms(Object player, String perms)
MethodInterface
hasPerms
in interface MethodInterface
player
- the playerperms
- the permspublic boolean isOnline(String name)
MethodInterface
isOnline
in interface MethodInterface
name
- the namepublic Player getPlayer(String name)
MethodInterface
getPlayer
in interface MethodInterface
name
- the namepublic void kickPlayer(String player, String reason)
MethodInterface
kickPlayer
in interface MethodInterface
player
- the playerreason
- the reasonpublic Player[] getOnlinePlayers()
MethodInterface
getOnlinePlayers
in interface MethodInterface
public void scheduleAsyncRep(Runnable rn, long l1, long l2)
MethodInterface
scheduleAsyncRep
in interface MethodInterface
rn
- the rnl1
- the l 1l2
- the l 2public void scheduleAsync(Runnable rn, long l1)
MethodInterface
scheduleAsync
in interface MethodInterface
rn
- the rnl1
- the l 1public void runAsync(Runnable rn)
MethodInterface
runAsync
in interface MethodInterface
rn
- the rnpublic void runSync(Runnable rn)
MethodInterface
runSync
in interface MethodInterface
rn
- the rnpublic void executeCommand(String cmd)
MethodInterface
executeCommand
in interface MethodInterface
cmd
- the cmdpublic String getName(Object player)
MethodInterface
getName
in interface MethodInterface
player
- the playerpublic String getName(String uuid)
MethodInterface
getName
in interface MethodInterface
uuid
- the uuidpublic String getIP(Object player)
MethodInterface
getIP
in interface MethodInterface
player
- the playerpublic String getInternUUID(Object player)
MethodInterface
getInternUUID
in interface MethodInterface
player
- the playerpublic String getInternUUID(String player)
MethodInterface
getInternUUID
in interface MethodInterface
player
- the playerpublic boolean callChat(Object player)
MethodInterface
callChat
in interface MethodInterface
player
- the playerpublic boolean callCMD(Object player, String cmd)
MethodInterface
callCMD
in interface MethodInterface
player
- the playercmd
- the cmdpublic void loadMySQLFile(File f)
MethodInterface
loadMySQLFile
in interface MethodInterface
f
- the fpublic void createMySQLFile(File f)
MethodInterface
createMySQLFile
in interface MethodInterface
f
- the fpublic YamlConfiguration getMySQLFile()
MethodInterface
getMySQLFile
in interface MethodInterface
public String parseJSON(InputStreamReader json, String key)
MethodInterface
parseJSON
in interface MethodInterface
json
- the jsonkey
- the keypublic String parseJSON(String json, String key)
MethodInterface
parseJSON
in interface MethodInterface
json
- the jsonkey
- the keypublic Boolean getBoolean(Object file, String path)
MethodInterface
getBoolean
in interface MethodInterface
file
- the filepath
- the pathpublic String getString(Object file, String path)
MethodInterface
getString
in interface MethodInterface
file
- the filepath
- the pathpublic Long getLong(Object file, String path)
MethodInterface
getLong
in interface MethodInterface
file
- the filepath
- the pathpublic Integer getInteger(Object file, String path)
MethodInterface
getInteger
in interface MethodInterface
file
- the filepath
- the pathpublic List<String> getStringList(Object file, String path)
MethodInterface
getStringList
in interface MethodInterface
file
- the filepath
- the pathpublic boolean getBoolean(Object file, String path, boolean def)
MethodInterface
getBoolean
in interface MethodInterface
file
- the filepath
- the pathdef
- the defpublic String getString(Object file, String path, String def)
MethodInterface
getString
in interface MethodInterface
file
- the filepath
- the pathdef
- the defpublic long getLong(Object file, String path, long def)
MethodInterface
getLong
in interface MethodInterface
file
- the filepath
- the pathdef
- the defpublic int getInteger(Object file, String path, int def)
MethodInterface
getInteger
in interface MethodInterface
file
- the filepath
- the pathdef
- the defpublic boolean contains(Object file, String path)
MethodInterface
contains
in interface MethodInterface
file
- the filepath
- the pathpublic String getFileName(Object file)
MethodInterface
getFileName
in interface MethodInterface
file
- the filepublic void callPunishmentEvent(Punishment punishment)
MethodInterface
callPunishmentEvent
in interface MethodInterface
punishment
- the punishmentpublic void callRevokePunishmentEvent(Punishment punishment, boolean massClear)
MethodInterface
callRevokePunishmentEvent
in interface MethodInterface
punishment
- the punishmentmassClear
- the mass clearpublic boolean isOnlineMode()
MethodInterface
isOnlineMode
in interface MethodInterface
public void notify(String perm, List<String> notification)
MethodInterface
notify
in interface MethodInterface
perm
- the permnotification
- the notificationpublic void log(String msg)
MethodInterface
log
in interface MethodInterface
msg
- the msgpublic boolean isUnitTesting()
MethodInterface
isUnitTesting
in interface MethodInterface
Copyright © 2020. All rights reserved.