public void onMinecartMeetConditionEvent(MinecartMeetsConditionEvent event) { if (event.isMeetCondition()) { return; } Sign sign = event.getSign(); MinecartManiaMinecart minecart = event.getMinecart(); MinecartManiaPlayer player = null; Object old = null; if (minecart.hasPlayerPassenger()) { player = MinecartManiaWorld.getMinecartManiaPlayer(minecart.getPlayerPassenger()); old = player.getDataValue("Reset Station Data"); player.setDataValue("Reset Station Data", true); } loop: for (int i = 0; i < sign.getNumLines(); i++) { String line = StringUtils.removeBrackets(sign.getLine(i).trim()); for (StationCondition e : StationCondition.values()) { if (e.result(minecart, line)) { event.setMeetCondition(true); break loop; } } } if (player != null) { player.setDataValue("Reset Station Data", old); } }
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { Player player = (Player) sender; if (args.length < 1) { return false; } MinecartManiaPlayer mmp = MinecartManiaWorld.getMinecartManiaPlayer(player); String station = args[0]; mmp.setLastStation(station); if (args.length > 1) { if (args[1].contains("s")) { mmp.setDataValue("Reset Station Data", Boolean.TRUE); } } else { mmp.setDataValue("Reset Station Data", null); } mmp.sendMessage(LocaleParser.getTextKey("AdminControlsStation", station)); return true; }