本文整理匯總了Java中org.bukkit.event.player.PlayerKickEvent.getReason方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerKickEvent.getReason方法的具體用法?Java PlayerKickEvent.getReason怎麽用?Java PlayerKickEvent.getReason使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.player.PlayerKickEvent
的用法示例。
在下文中一共展示了PlayerKickEvent.getReason方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPlayerKick
import org.bukkit.event.player.PlayerKickEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerKick(PlayerKickEvent event){
Player player = event.getPlayer();
Location location = player.getLocation();
PlayerKickObsel obsel = new PlayerKickObsel(
new Date().getTime(),
location.getBlockX(),
location.getBlockY(),
location.getBlockZ(),
location.getWorld().getName(),
player.getName(),
event.getReason());
JSONObselManager.getInstance().addObsel(obsel);
}
示例2: disconnect
import org.bukkit.event.player.PlayerKickEvent; //導入方法依賴的package包/類
public void disconnect(String s) {
// CraftBukkit start - fire PlayerKickEvent
String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game.";
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
if (this.server.getServer().isRunning()) {
this.server.getPluginManager().callEvent(event);
}
if (event.isCancelled()) {
// Do not kick the player
return;
}
// Send the possibly modified leave message
s = event.getReason();
// CraftBukkit end
ChatComponentText chatcomponenttext = new ChatComponentText(s);
this.networkManager.handle(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener[] { new PlayerConnectionFuture(this, chatcomponenttext)});
this.a(chatcomponenttext); // CraftBukkit - Process quit immediately
this.networkManager.g();
}
示例3: onKick
import org.bukkit.event.player.PlayerKickEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onKick(PlayerKickEvent e) {
if (plugin.vanishLoaded() && VNPHandler.isVanished(e.getPlayer())) return;
String message = Config.btiKick;
final String reason = (e.getReason().isEmpty()) ? Config.defaultReason : e.getReason();
message = replaceVars(e, message);
message = message.replace("{message}", reason.replaceAll("\\r?\\n", " "));
plugin.bh.sendMessage(message);
}
示例4: disconnect
import org.bukkit.event.player.PlayerKickEvent; //導入方法依賴的package包/類
public void disconnect(String s) {
if (!this.disconnected) {
// CraftBukkit start
String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game.";
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
if (this.server.getServer().isRunning()) {
this.server.getPluginManager().callEvent(event);
}
if (event.isCancelled()) {
// Do not kick the player
return;
}
// Send the possibly modified leave message
s = event.getReason();
// CraftBukkit end
this.player.l();
this.sendPacket(new Packet255KickDisconnect(s));
this.networkManager.d();
// CraftBukkit start
leaveMessage = event.getLeaveMessage();
if (leaveMessage != null && leaveMessage.length() > 0) {
this.minecraftServer.getPlayerList().sendMessage(ChatMessage.d(leaveMessage));
}
// CraftBukkit end
this.minecraftServer.getPlayerList().disconnect(this.player);
this.disconnected = true;
}
}
示例5: kickPlayerFromServer
import org.bukkit.event.player.PlayerKickEvent; //導入方法依賴的package包/類
public void kickPlayerFromServer(String p_147360_1_)
{
// CraftBukkit start
String leaveMessage = EnumChatFormatting.YELLOW + this.playerEntity.getCommandSenderName() + " left the game.";
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.playerEntity), p_147360_1_, leaveMessage);
if (this.server.getServer().isServerRunning())
{
this.server.getPluginManager().callEvent(event);
}
if (event.isCancelled())
{
// Do not kick the player
return;
}
// Send the possibly modified leave message
p_147360_1_ = event.getReason();
// CraftBukkit end
final ChatComponentText chatcomponenttext = new ChatComponentText(p_147360_1_);
this.netManager.scheduleOutboundPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener[] {new GenericFutureListener()
{
private static final String __OBFID = "CL_00001453";
public void operationComplete(Future p_operationComplete_1_)
{
NetHandlerPlayServer.this.netManager.closeChannel(chatcomponenttext);
}
}});
this.onDisconnect(chatcomponenttext); // CraftBukkit - Process quit immediately
this.netManager.disableAutoRead();
}
示例6: disconnect
import org.bukkit.event.player.PlayerKickEvent; //導入方法依賴的package包/類
public void disconnect(String s) {
// CraftBukkit start - fire PlayerKickEvent
String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game.";
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
if (this.server.getServer().isRunning()) {
this.server.getPluginManager().callEvent(event);
}
if (event.isCancelled()) {
// Do not kick the player
return;
}
// Send the possibly modified leave message
s = event.getReason();
// CraftBukkit end
final ChatComponentText chatcomponenttext = new ChatComponentText(s);
this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener() {
public void operationComplete(Future future) throws Exception { // CraftBukkit - decompile error
PlayerConnection.this.networkManager.close(chatcomponenttext);
}
}, new GenericFutureListener[0]);
this.a(chatcomponenttext); // CraftBukkit - fire quit instantly
this.networkManager.stopReading();
// CraftBukkit - Don't wait
this.minecraftServer.postToMainThread(new Runnable() {
public void run() {
PlayerConnection.this.networkManager.handleDisconnection();
}
});
}
示例7: disconnect
import org.bukkit.event.player.PlayerKickEvent; //導入方法依賴的package包/類
public void disconnect(String s) {
if (!this.disconnected) {
// CraftBukkit start
String leaveMessage = EnumChatFormat.YELLOW + this.player.name + " left the game.";
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
if (this.server.getServer().isRunning()) {
this.server.getPluginManager().callEvent(event);
}
if (event.isCancelled()) {
// Do not kick the player
return;
}
// Send the possibly modified leave message
s = event.getReason();
// CraftBukkit end
this.player.k();
this.sendPacket(new Packet255KickDisconnect(s));
this.networkManager.d();
// CraftBukkit start
leaveMessage = event.getLeaveMessage();
if (leaveMessage != null && leaveMessage.length() > 0) {
this.minecraftServer.getPlayerList().sendAll(new Packet3Chat(leaveMessage));
}
// CraftBukkit end
this.minecraftServer.getPlayerList().disconnect(this.player);
this.disconnected = true;
}
}
示例8: onKick
import org.bukkit.event.player.PlayerKickEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onKick(PlayerKickEvent e) {
if (this.plugin.usingLiteBans()) {
if (e.getReason() != null) {
if (e.getReason() != null) {
this.setupMessagesConfig();
if (!e.getReason().equals("")) {
String reasonMsg = "";
for (String line : e.getReason().split("\\n+")) {
reasonMsg += line + "\n";
}
if (reasonMsg.length() > 0) {
reasonMsg = reasonMsg.substring(0, reasonMsg.length() - 2);
}
boolean liteBan = false;
String[] reasonLines = reasonMsg.replace("§", "&").split("\\n+");
String[] bannedLines = this.messagesConfig.getString("banned_message").replace("$base", this.messagesConfig.getString("banned_message_base")).replace("$appealMessage", this.messagesConfig.getString("banned_message_appeal_message")).split("\\n+");
String[] bannedPermanentLines = this.messagesConfig.getString("banned_message_permanent").replace("$base", this.messagesConfig.getString("banned_message_base")).replace("$appealMessage", this.messagesConfig.getString("banned_message_appeal_message")).split("\\n+");
if (reasonLines.length == bannedLines.length || reasonLines.length == bannedPermanentLines.length) {
liteBan = true;
for (int i = 0; i < reasonLines.length && i < bannedLines.length && i < bannedPermanentLines.length; i++) {
if (!reasonLines[i].equals("")) {
int permanentIndex = bannedPermanentLines[i].contains("$") ? bannedPermanentLines[i].indexOf("$") : reasonLines[i].length();
int bannedIndex = bannedLines[i].contains("$") ? bannedLines[i].indexOf("$") : reasonLines[i].length();
if (!(reasonLines[i].substring(0, permanentIndex).equals(bannedPermanentLines[i].substring(0, permanentIndex)) || (reasonLines[i].substring(0, bannedIndex).equals(bannedLines[i].substring(0, bannedIndex))))) {
liteBan = false;
break;
}
}
}
}
if (liteBan && this.playerManager.isFrozen(e.getPlayer()) && !this.playerManager.isFreezeAllFrozen(e.getPlayer().getUniqueId())) {
this.freezeManager.unfreeze(e.getPlayer().getUniqueId());
}
}
}
}
}
}