本文整理匯總了Java中org.bukkit.event.player.PlayerGameModeChangeEvent.getPlayer方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerGameModeChangeEvent.getPlayer方法的具體用法?Java PlayerGameModeChangeEvent.getPlayer怎麽用?Java PlayerGameModeChangeEvent.getPlayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.player.PlayerGameModeChangeEvent
的用法示例。
在下文中一共展示了PlayerGameModeChangeEvent.getPlayer方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPlayerGameModeChangeEvent
import org.bukkit.event.player.PlayerGameModeChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerGameModeChangeEvent(PlayerGameModeChangeEvent event)
{
Player player = event.getPlayer();
if (!WorldGuardUtils.hasBypass(player))
{
new BukkitRunnable()
{
@Override
public void run()
{
try
{
event.getPlayer().setAllowFlight(WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getSessionManager().get(player).getHandler(FlyFlag.class).getCurrentValue());
}
catch(Exception ignored)
{
}
}
}.runTask(WorldGuardExtraFlagsPlugin.getPlugin());
}
}
示例2: onPlayerGameModeChange
import org.bukkit.event.player.PlayerGameModeChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
Player player = event.getPlayer();
GameMode oldGameMode = player.getGameMode();
GameMode newGameMode = event.getNewGameMode();
Group group = plugin.getGroupManager().getGroupFromWorld(player.getWorld().getName());
if (group == null) {
group = new Group(player.getWorld().getName(), null, null);
}
plugin.getSerializer().writePlayerDataToFile(player,
PlayerSerialization.serializePlayer(player, plugin),
group,
oldGameMode);
plugin.getSerializer().getPlayerDataFromFile(
player,
group,
newGameMode);
}
示例3: onPlayerQuitCreative
import org.bukkit.event.player.PlayerGameModeChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerQuitCreative(final PlayerGameModeChangeEvent event) {
if (event.getPlayer().getGameMode() == GameMode.CREATIVE) {
final boolean wasFlying = event.getPlayer().isFlying();
final Player player = event.getPlayer();
if (Perms.hasFly(event.getPlayer()) && this.feature.hasFlyMode(event.getPlayer())) {
Bukkit.getScheduler().runTaskLater(this.feature.getPlugin(), new BukkitRunnable() {
@Override
public void run() {
if (player.isOnline()) {
player.setAllowFlight(true);
player.setFlying(wasFlying);
}
}
}, 1L);
}
}
}
示例4: onChangeGM
import org.bukkit.event.player.PlayerGameModeChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onChangeGM(PlayerGameModeChangeEvent e) {
Player p = e.getPlayer();
UUID pU = e.getPlayer().getUniqueId();
int GamemodeTemp1 = 0;
if (e.getNewGameMode() == GameMode.SURVIVAL) {
GamemodeTemp1 = 0;
} else if (e.getNewGameMode() == GameMode.CREATIVE) {
GamemodeTemp1 = 1;
} else if (e.getNewGameMode() == GameMode.ADVENTURE) {
GamemodeTemp1 = 2;
} else if (e.getNewGameMode() == GameMode.SPECTATOR) {
GamemodeTemp1 = 3;
}
int GamemodeTemp2 = Integer.valueOf(GamemodeTemp1);
if (!ConfigTemp.getConfig().contains(String.valueOf(pU))) {
ConfigTemp.getConfig().set(pU+".Player", String.valueOf(p));
ConfigTemp.getConfig().set(pU+".Options.Gamemode", Integer.valueOf(GamemodeTemp2));
ConfigTemp.saveConfigFile();
} else if (ConfigTemp.getConfig().contains(String.valueOf(pU))) {
ConfigTemp.getConfig().set(pU+".Player", String.valueOf(p));
ConfigTemp.getConfig().set(pU+".Options.Gamemode", Integer.valueOf(GamemodeTemp2));
ConfigTemp.saveConfigFile();
}
}
示例5: onGameModeSwitch
import org.bukkit.event.player.PlayerGameModeChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onGameModeSwitch(PlayerGameModeChangeEvent event) {
Player player = event.getPlayer();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
if (event.getNewGameMode() == GameMode.CREATIVE) {
InventoryLocker.unlockSlots(player);
} else if (event.getPlayer().getGameMode() == GameMode.CREATIVE) {
InventoryLocker.lockSlots(player, true);
}
}
示例6: onGamemodeChange
import org.bukkit.event.player.PlayerGameModeChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onGamemodeChange(PlayerGameModeChangeEvent event)
{
Player player = event.getPlayer();
if (event.getNewGameMode() != GameMode.CREATIVE || Thirst.getInstance().getYAMLConfig().ignoreCreative)
{
ThirstManager.getThirst().displayThirst(player);
return;
}
else if (event.getNewGameMode() == GameMode.CREATIVE && !Thirst.getInstance().getYAMLConfig().ignoreCreative)
{
for (PotionEffect effect : player.getActivePotionEffects())
{
player.removePotionEffect(effect.getType());
}
}
if (Thirst.getInstance().getYAMLConfig().displayType.equalsIgnoreCase("scoreboard"))
{
if (Thirst.getInstance().getYAMLConfig().displayType.equalsIgnoreCase("SCOREBOARD"))
player.setScoreboard(Bukkit.getServer().getScoreboardManager().getNewScoreboard());
}
else if (Thirst.getInstance().getYAMLConfig().displayType.equalsIgnoreCase("action"))
{
UtilActionBar.getInstance().sendActionBar(player, "");
}
else if (Thirst.getInstance().getYAMLConfig().displayType.equalsIgnoreCase("bossbar"))
{
ThirstData data = ThirstManager.getThirst().getThirstData(player);
if (data.getBar() != null)
{
data.getBar().removePlayer(player);
}
}
}
示例7: onGameModeChange
import org.bukkit.event.player.PlayerGameModeChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onGameModeChange(PlayerGameModeChangeEvent e) {
Player p = e.getPlayer();
if (playerStateInfoMap.containsKey(p) && e.getNewGameMode() != GameMode.SPECTATOR) {
// Don't let low-priority event listeners cancel the gamemode change
if (e.isCancelled()) e.setCancelled(false);
}
}
示例8: onPlayerGameModeChange
import org.bukkit.event.player.PlayerGameModeChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
if (event.isCancelled()) {
return;
}
Player player = event.getPlayer();
Group group = groupManager.getGroupFromWorld(player.getWorld().getName());
ConsoleLogger.debug("[GM PROCESS] Player '" + player.getName() + "' changed to GameMode '" +
event.getNewGameMode().name() + "' in group '" + group.getName() + "'");
playerManager.addPlayer(player, group);
bukkitService.runTaskLater(() -> process.processGameModeChange(player, event.getNewGameMode(), group), 1L);
}
示例9: onPlayerGameModeChange
import org.bukkit.event.player.PlayerGameModeChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event){
if(enableEventGameModeChange) {
try {
Player player = (Player) event.getPlayer();
if(!player.hasPermission("googleanalyticsplugin.ignore")) {
plugin.getTracker().TrackAction(getClientName(plugin, player), getClientId(player), getClientIP(player.getAddress().getAddress()), player.getName(), "Game Mode Change", "Game Mode " + getGamemode(event.getNewGameMode()));
}
}
catch(Exception e) {
plugin.getLogger().warning("Event Listener Error: " + e.getMessage());
}
}
}
示例10: gamemodeChange
import org.bukkit.event.player.PlayerGameModeChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void gamemodeChange(PlayerGameModeChangeEvent event) {
RocketFunctions rocketFunctions = new RocketFunctions();
CommonString commonString = new CommonString();
GamemodeCheck gamemodeCheck = new GamemodeCheck();
TitleSubtitle titleSubtitle = new TitleSubtitle();
Player player = event.getPlayer();
if (!RocketInit.rocketUsage.isEmpty())
if (RocketInit.rocketUsage.contains(player.getUniqueId()))
if (gamemodeCheck.check(player, GameMode.CREATIVE, GameMode.SPECTATOR)) {
commonString.messageSend(RocketInit.getPlugin(), player, true, RocketLanguage.RB_GAMEMODE_ERROR);
titleSubtitle.subtitle(player, 1, RocketLanguage.RB_GAMEMODE_ERROR);
rocketFunctions.disableRocketBoots(player, false, false, false, false, false);
}
}