@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; }
public void onMinecartIntersectionEvent(MinecartIntersectionEvent event) { MinecartManiaMinecart minecart = event.getMinecart(); if (event.isActionTaken()) { return; } if (ControlBlockList.isValidStationBlock(minecart)) { SignCommands.processStation(event); } if (event.isActionTaken()) { return; } if (StationUtil.shouldPromptUser(minecart)) { minecart.setDataValue("preintersection velocity", minecart.minecart.getVelocity().clone()); minecart.stopCart(); Player passenger = minecart.getPlayerPassenger(); // set the track straight int data = DirectionUtils.getMinetrackRailDataForDirection( minecart.getDirection(), minecart.getDirection()); Block oldBlock = MinecartManiaWorld.getBlockAt( minecart.minecart.getWorld(), minecart.getX(), minecart.getY(), minecart.getZ()); ArrayList<Integer> blockData = new ArrayList<Integer>(); blockData.add(new Integer(oldBlock.getX())); blockData.add(new Integer(oldBlock.getY())); blockData.add(new Integer(oldBlock.getZ())); blockData.add(new Integer(oldBlock.getData())); minecart.setDataValue("old rail data", blockData); if (data != -1) { MinecartManiaWorld.setBlockData( minecart.minecart.getWorld(), minecart.getX(), minecart.getY(), minecart.getZ(), data); } passenger.sendMessage(LocaleParser.getTextKey("StationsTapInDirection")); } }