@Override public void onPlayerJoined(Player player) { logger.info("Player " + player.toString() + " joined world " + this.toString()); players.add(player); ((NailedPlayer) player).sendPacket(new S41PacketServerDifficulty(wrapped.getDifficulty(), false)); if(this.getConfig().resourcePackUrl() != null){ player.loadResourcePack(this.getConfig().resourcePackUrl(), ""); //TODO: fix hash } }
@Override public void setDifficulty(Difficulty difficulty) { EnumDifficulty diff = EnumDifficulty.getDifficultyEnum(difficulty.getId()); this.wrapped.getWorldInfo().setDifficulty(diff); for (Player player : this.players) { ((NailedPlayer) player).sendPacket(new S41PacketServerDifficulty(diff, false)); } if(difficulty == Difficulty.PEACEFUL){ wrapped.setAllowedSpawnTypes(false, true); }else{ wrapped.setAllowedSpawnTypes(true, true); } }
public void handleServerDifficulty(S41PacketServerDifficulty packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.theWorld.getWorldInfo().setDifficulty(packetIn.getDifficulty()); this.gameController.theWorld.getWorldInfo().setDifficultyLocked(packetIn.isDifficultyLocked()); }
void handleServerDifficulty(S41PacketServerDifficulty packetIn);