本文整理汇总了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));
}
}
示例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);
}
}
示例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;
}
}
示例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));
}
}
示例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));
}
}
}
示例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;
}
示例7: setPlayerWeather
import org.bukkit.WeatherType; //导入依赖的package包/类
@Override
public void setPlayerWeather(WeatherType type)
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
示例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);
}
示例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]);
}
示例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;
}
示例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
}
}
示例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;
}
}
}
示例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
}
}
示例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));
}
示例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
}