Java 类org.bukkit.WeatherType 实例源码

项目:Skellett    文件:ExprClientWeather.java   
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
    if (mode == ChangeMode.SET) {
        String w = (String)delta[0];
        WeatherType t = null;
        try {
            t = WeatherType.valueOf(w.replace("\"", "").trim().replace(" ", "_").toUpperCase());
        } catch (IllegalArgumentException error) {
            Bukkit.getConsoleSender().sendMessage(Skellett.cc(Skellett.prefix + "&cUnknown weather type " + w));
            return;
        }
        if (t != null) {
            player.getSingle(e).setPlayerWeather(t);
        }
    } else if (mode == ChangeMode.RESET) {
        player.getSingle(e).setPlayerWeather(WeatherType.CLEAR);
    }
}
项目:CraftBukkit    文件:EntityPlayer.java   
public void setPlayerWeather(WeatherType type, boolean plugin) {
    if (!plugin && this.weather != null) {
        return;
    }

    if (plugin) {
        this.weather = type;
    }

    if (type == WeatherType.DOWNFALL) {
        this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(2, 0));
        // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, this.world.j(1.0F)));
        // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, this.world.h(1.0F)));
    } else {
        this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0));
    }
}
项目:Tweakkit-Server    文件:EntityPlayer.java   
public void setPlayerWeather(WeatherType type, boolean plugin) {
    if (!plugin && this.weather != null) {
        return;
    }

    if (plugin) {
        this.weather = type;
    }

    if (type == WeatherType.DOWNFALL) {
        this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(2, 0));
        // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, this.world.j(1.0F)));
        // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, this.world.h(1.0F)));
    } else {
        this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0));
    }
}
项目:PlotSquared    文件:BukkitPlayer.java   
@Override
public void setWeather(PlotWeather weather) {
    switch (weather) {
        case CLEAR:
            this.player.setPlayerWeather(WeatherType.CLEAR);
            break;
        case RAIN:
            this.player.setPlayerWeather(WeatherType.DOWNFALL);
            break;
        case RESET:
            this.player.resetPlayerWeather();
            break;
        default:
            this.player.resetPlayerWeather();
            break;
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void setPlayerWeather(WeatherType type, boolean plugin)
{
    if (!plugin && this.weather != null)
    {
        return;
    }

    if (plugin)
    {
        this.weather = type;
    }

    if (type == WeatherType.DOWNFALL)
    {
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(2, 0));
        // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, this.world.j(1.0F)));
        // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, this.world.h(1.0F)));
    }
    else
    {
        this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0));
    }
}
项目:SpigotSource    文件:EntityPlayer.java   
public void updateWeather(float oldRain, float newRain, float oldThunder, float newThunder) {
    if (this.weather == null) {
        // Vanilla
        if (oldRain != newRain) {
            this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, newRain));
        }
    } else {
        // Plugin
        if (pluginRainPositionPrevious != pluginRainPosition) {
            this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, pluginRainPosition));
        }
    }

    if (oldThunder != newThunder) {
        if (weather == WeatherType.DOWNFALL || weather == null) {
            this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, newThunder));
        } else {
            this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, 0));
        }
    }
}
项目:tregmine    文件:WeatherCommand.java   
@Override
public boolean handlePlayer(TregminePlayer player, String[] args)
{
    if (!player.getRank().canSetWeather()) {
        return true;
    }
    if (args.length != 1) {
        player.sendMessage("/weather <downfall or clear>");
        player.resetPlayerWeather();
        return true;
    }

    try {
        WeatherType type = WeatherType.valueOf(args[0].toUpperCase());
        player.setPlayerWeather(type);
        player.sendMessage(YELLOW + "Weather set to " + type);
    }
    catch (IllegalArgumentException e) {
        return false;
    }

    return true;
}
项目:MockBukkit    文件:PlayerMock.java   
@Override
public void setPlayerWeather(WeatherType type)
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();

}
项目:Debuggery    文件:InputFormatterTest.java   
@Test
public void testValueFromEnum() throws InputException {
    Class[] inputTypes = {
            WeatherType.class,
            EquipmentSlot.class,
            MainHand.class,
            PermissionDefault.class
    };

    String[] input = {
            "downfall",
            "HeAd",
            "lEfT",
            "NOT_OP"
    };

    Object[] output = InputFormatter.getTypesFromInput(inputTypes, Arrays.asList(input), null);

    // First let's make sure we didn't lose anything, or get anything
    assertEquals(inputTypes.length, output.length);

    // Next let's make sure everything is the right type
    assertTrue(output[0] instanceof WeatherType);
    assertTrue(output[1] instanceof EquipmentSlot);
    assertTrue(output[2] instanceof MainHand);
    assertTrue(output[3] instanceof PermissionDefault);

    // Finally, let's make sure the values are correct
    assertSame(output[0], WeatherType.DOWNFALL);
    assertSame(output[1], EquipmentSlot.HEAD);
    assertSame(output[2], MainHand.LEFT);
    assertSame(output[3], PermissionDefault.NOT_OP);
}
项目:Kineticraft    文件:CommandPWeather.java   
@Override
protected void onCommand(CommandSender sender, String[] args) {
    if (args[0].equalsIgnoreCase("reset")) {
        ((Player) sender).resetPlayerWeather();
        sender.sendMessage(ChatColor.GOLD + "Weather returned to normal.");
        return;
    }

    ((Player) sender).setPlayerWeather(WeatherType.valueOf(args[0].toUpperCase()));
    sender.sendMessage(ChatColor.GOLD + "Weather set to " + ChatColor.RED + args[0]);
}
项目:Skellett    文件:ExprClientWeather.java   
@Override
@Nullable
protected WeatherType[] get(Event e) {
    if (player != null && player.getSingle(e).getPlayerWeather() != null) {
        return new WeatherType[]{player.getSingle(e).getPlayerWeather()};
    }
    return null;
}
项目:CraftBukkit    文件:WorldServer.java   
protected void o() {
    boolean flag = this.Q();

    super.o();
    /* CraftBukkit start
    if (this.m != this.n) {
        this.server.getPlayerList().a(new PacketPlayOutGameStateChange(7, this.n), this.worldProvider.dimension);
    }

    if (this.o != this.p) {
        this.server.getPlayerList().a(new PacketPlayOutGameStateChange(8, this.p), this.worldProvider.dimension);
    }

    if (flag != this.Q()) {
        if (flag) {
            this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(2, 0.0F));
        } else {
            this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(1, 0.0F));
        }

        this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.n));
        this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.p));
    }
    // */
    if (flag != this.Q()) {
        // Only send weather packets to those affected
        for (int i = 0; i < this.players.size(); ++i) {
            if (((EntityPlayer) this.players.get(i)).world == this) {
                ((EntityPlayer) this.players.get(i)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
            }
        }
        // CraftBukkit end
    }
}
项目:PlotSquared-Chinese    文件:PlotListener.java   
private void setWeather(Player player, String str) {
    switch (str.toLowerCase()) {
        case "clear": {
            player.setPlayerWeather(WeatherType.CLEAR);
            return;
        }
        case "rain": {
            player.setPlayerWeather(WeatherType.DOWNFALL);
            return;
        }
    }
}
项目:Almura-Server    文件:WorldServer.java   
protected void o() {
    boolean flag = this.Q();

    super.o();
    if (flag != this.Q()) {
        // CraftBukkit start - Only send weather packets to those affected
        for (int i = 0; i < this.players.size(); ++i) {
            if (((EntityPlayer) this.players.get(i)).world == this) {
                ((EntityPlayer) this.players.get(i)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
            }
        }
        // CraftBukkit end
    }
}
项目:Almura-Server    文件:EntityPlayer.java   
public void setPlayerWeather(WeatherType type, boolean plugin) {
    if (!plugin && this.weather != null) {
        return;
    }

    if (plugin) {
        this.weather = type;
    }

    this.playerConnection.sendPacket(new Packet70Bed(type == WeatherType.DOWNFALL ? 1 : 2, 0));
}
项目:Tweakkit-Server    文件:WorldServer.java   
protected void o() {
    boolean flag = this.Q();

    super.o();
    /* CraftBukkit start
    if (this.m != this.n) {
        this.server.getPlayerList().a(new PacketPlayOutGameStateChange(7, this.n), this.worldProvider.dimension);
    }

    if (this.o != this.p) {
        this.server.getPlayerList().a(new PacketPlayOutGameStateChange(8, this.p), this.worldProvider.dimension);
    }

    if (flag != this.Q()) {
        if (flag) {
            this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(2, 0.0F));
        } else {
            this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(1, 0.0F));
        }

        this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.n));
        this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.p));
    }
    // */
    if (flag != this.Q()) {
        // Only send weather packets to those affected
        for (int i = 0; i < this.players.size(); ++i) {
            if (((EntityPlayer) this.players.get(i)).world == this) {
                ((EntityPlayer) this.players.get(i)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
            }
        }
        // CraftBukkit end
    }
}
项目:SpigotSource    文件:WorldServer.java   
protected void t() {
    boolean flag = this.W();

    super.t();
    /* CraftBukkit start
    if (this.n != this.o) {
        this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.o)), this.worldProvider.getDimensionManager().getDimensionID());
    }

    if (this.p != this.q) {
        this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(8, this.q)), this.worldProvider.getDimensionManager().getDimensionID());
    }

    if (flag != this.W()) {
        if (flag) {
            this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(2, 0.0F));
        } else {
            this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(1, 0.0F));
        }

        this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.o));
        this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.q));
    }
    // */
    if (flag != this.W()) {
        // Only send weather packets to those affected
        for (int i = 0; i < this.players.size(); ++i) {
            if (((EntityPlayer) this.players.get(i)).world == this) {
                ((EntityPlayer) this.players.get(i)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
            }
        }
    }
    for (int i = 0; i < this.players.size(); ++i) {
        if (((EntityPlayer) this.players.get(i)).world == this) {
            ((EntityPlayer) this.players.get(i)).updateWeather(this.n, this.o, this.p, this.q);
        }
    }
    // CraftBukkit end

}
项目:SpigotSource    文件:EntityPlayer.java   
public void setPlayerWeather(WeatherType type, boolean plugin) {
    if (!plugin && this.weather != null) {
        return;
    }

    if (plugin) {
        this.weather = type;
    }

    if (type == WeatherType.DOWNFALL) {
        this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(2, 0));
    } else {
        this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0));
    }
}
项目:SpigotSource    文件:EntityPlayer.java   
public void tickWeather() {
    if (this.weather == null) return;

    pluginRainPositionPrevious = pluginRainPosition;
    if (weather == WeatherType.DOWNFALL) {
        pluginRainPosition += 0.01;
    } else {
        pluginRainPosition -= 0.01;
    }

    pluginRainPosition = MathHelper.a(pluginRainPosition, 0.0F, 1.0F);
}
项目:Demigods3    文件:Storm.java   
public static void setWeather(final Player player, long ticks) {
    // Set the weather
    player.setPlayerWeather(WeatherType.DOWNFALL);

    // Create the runnable to switch back
    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(DemigodsPlugin.getInst(), new BukkitRunnable() {
        @Override
        public void run() {
            player.resetPlayerWeather();
        }
    }, ticks);
}
项目:Craft-city    文件:WorldServer.java   
protected void n() {
    boolean flag = this.O();

    super.n();
    if (flag != this.O()) {
        // CraftBukkit start - Only send weather packets to those affected
        for (int i = 0; i < this.players.size(); ++i) {
            if (((EntityPlayer) this.players.get(i)).world == this) {
                ((EntityPlayer) this.players.get(i)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
            }
        }
        // CraftBukkit end
    }
}
项目:Craft-city    文件:EntityPlayer.java   
public void setPlayerWeather(WeatherType type, boolean plugin) {
    if (!plugin && this.weather != null) {
        return;
    }

    if (plugin) {
        this.weather = type;
    }

    this.playerConnection.sendPacket(new Packet70Bed(type == WeatherType.DOWNFALL ? 1 : 2, 0));
}
项目:MockBukkit    文件:PlayerMock.java   
@Override
public WeatherType getPlayerWeather()
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();
}
项目:HiddenOre    文件:FakePlayer.java   
@Override
public WeatherType getPlayerWeather() {

    return null;
}
项目:Pokkit    文件:PokkitPlayer.java   
@Override
public WeatherType getPlayerWeather() {
    throw Pokkit.unsupported();

}
项目:Pokkit    文件:PokkitPlayer.java   
@Override
public void setPlayerWeather(WeatherType arg0) {
    throw Pokkit.unsupported();

}
项目:Skellett    文件:ExprClientWeather.java   
@Override
public Class<? extends WeatherType> getReturnType() {
    return WeatherType.class;
}
项目:CanaryBukkit    文件:CanaryPlayer.java   
public WeatherType getPlayerWeather() {
    throw new NotImplementedException("getPlayerWeather()");
}
项目:CanaryBukkit    文件:CanaryPlayer.java   
public void setPlayerWeather(WeatherType type) {
    throw new NotImplementedException("setPlayerWeather(WeatherType)");
}
项目:CraftBukkit    文件:EntityPlayer.java   
public WeatherType getPlayerWeather() {
    return this.weather;
}
项目:CraftBukkit    文件:EntityPlayer.java   
public void resetPlayerWeather() {
    this.weather = null;
    this.setPlayerWeather(this.world.getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
}
项目:Almura-Server    文件:EntityPlayer.java   
public WeatherType getPlayerWeather() {
    return this.weather;
}
项目:Almura-Server    文件:EntityPlayer.java   
public void resetPlayerWeather() {
    this.weather = null;
    this.setPlayerWeather(this.world.getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
}
项目:BlockLocker    文件:TestPlayer.java   
@Override
public WeatherType getPlayerWeather() {
    throw new UnsupportedOperationException();

}
项目:BlockLocker    文件:TestPlayer.java   
@Override
public void setPlayerWeather(WeatherType type) {
    throw new UnsupportedOperationException();

}
项目:Tweakkit-Server    文件:EntityPlayer.java   
public WeatherType getPlayerWeather() {
    return this.weather;
}
项目:Tweakkit-Server    文件:EntityPlayer.java   
public void resetPlayerWeather() {
    this.weather = null;
    this.setPlayerWeather(this.world.getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
}
项目:Cauldron    文件:WorldServer.java   
protected void updateWeather()
{
    boolean flag = this.isRaining();
    super.updateWeather();

    /* CraftBukkit start
    if (this.prevRainingStrength != this.rainingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
    }

    if (this.prevThunderingStrength != this.thunderingStrength)
    {
        this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
    }

    if (flag != this.isRaining())
    {
        if (flag)
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F));
        }
        else
        {
            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F));
        }

        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength));
        this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength));
    }
    // */
    if (flag != this.isRaining())
    {
        // Only send weather packets to those affected
        for (int i = 0; i < this.playerEntities.size(); ++i)
        {
            if (((EntityPlayerMP) this.playerEntities.get(i)).worldObj == this)
            {
                ((EntityPlayerMP) this.playerEntities.get(i)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
            }
        }

        // CraftBukkit end
    }
}
项目:Cauldron    文件:EntityPlayerMP.java   
public WeatherType getPlayerWeather()
{
    return this.weather;
}
项目:Cauldron    文件:EntityPlayerMP.java   
public void resetPlayerWeather()
{
    this.weather = null;
    this.setPlayerWeather(this.worldObj.getWorldInfo().isRaining() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
}