当前位置: 首页>>代码示例>>Java>>正文


Java WeatherType类代码示例

本文整理汇总了Java中org.bukkit.WeatherType的典型用法代码示例。如果您正苦于以下问题:Java WeatherType类的具体用法?Java WeatherType怎么用?Java WeatherType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WeatherType类属于org.bukkit包,在下文中一共展示了WeatherType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPlayerWeather

import org.bukkit.WeatherType; //导入依赖的package包/类
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));
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:18,代码来源:EntityPlayer.java

示例2: change

import org.bukkit.WeatherType; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:19,代码来源:ExprClientWeather.java

示例3: setWeather

import org.bukkit.WeatherType; //导入依赖的package包/类
@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;
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:18,代码来源:BukkitPlayer.java

示例4: setPlayerWeather

import org.bukkit.WeatherType; //导入依赖的package包/类
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));
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:24,代码来源:EntityPlayerMP.java

示例5: updateWeather

import org.bukkit.WeatherType; //导入依赖的package包/类
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));
        }
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:22,代码来源:EntityPlayer.java

示例6: handlePlayer

import org.bukkit.WeatherType; //导入依赖的package包/类
@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;
}
 
开发者ID:EmilHernvall,项目名称:tregmine,代码行数:24,代码来源:WeatherCommand.java

示例7: setPlayerWeather

import org.bukkit.WeatherType; //导入依赖的package包/类
@Override
public void setPlayerWeather(WeatherType type)
{
	// TODO Auto-generated method stub
	throw new UnimplementedOperationException();

}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:8,代码来源:PlayerMock.java

示例8: testValueFromEnum

import org.bukkit.WeatherType; //导入依赖的package包/类
@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);
}
 
开发者ID:zachbr,项目名称:Debuggery,代码行数:34,代码来源:InputFormatterTest.java

示例9: onCommand

import org.bukkit.WeatherType; //导入依赖的package包/类
@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]);
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:12,代码来源:CommandPWeather.java

示例10: get

import org.bukkit.WeatherType; //导入依赖的package包/类
@Override
@Nullable
protected WeatherType[] get(Event e) {
	if (player != null && player.getSingle(e).getPlayerWeather() != null) {
		return new WeatherType[]{player.getSingle(e).getPlayerWeather()};
	}
	return null;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:9,代码来源:ExprClientWeather.java

示例11: o

import org.bukkit.WeatherType; //导入依赖的package包/类
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
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:35,代码来源:WorldServer.java

示例12: setWeather

import org.bukkit.WeatherType; //导入依赖的package包/类
private void setWeather(Player player, String str) {
    switch (str.toLowerCase()) {
        case "clear": {
            player.setPlayerWeather(WeatherType.CLEAR);
            return;
        }
        case "rain": {
            player.setPlayerWeather(WeatherType.DOWNFALL);
            return;
        }
    }
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:13,代码来源:PlotListener.java

示例13: o

import org.bukkit.WeatherType; //导入依赖的package包/类
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
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:15,代码来源:WorldServer.java

示例14: setPlayerWeather

import org.bukkit.WeatherType; //导入依赖的package包/类
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));
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:12,代码来源:EntityPlayer.java

示例15: t

import org.bukkit.WeatherType; //导入依赖的package包/类
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

}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:41,代码来源:WorldServer.java


注:本文中的org.bukkit.WeatherType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。