Exemple #1
0
	public boolean CrapsSign(Player player, Sign sign){
		String line2string = null;
		double line2 = 0;
		if(sign.getText(3).equalsIgnoreCase("GLOBAL")){
			if(player.canUseCommand("/scplaceglobal") || player.canUseCommand("/scadmin")){
				sign.setText(3, "GLOBAL");
			}
			else{
				if(!SC.SCD.canPlaceSign(2, player.getName())){
					player.sendMessage("[�ign��s�no] You have too many '�RAPS' signs");
					NoPlaceSign(sign);
					return false;
				}
				if(player.getName().length() > 15){
					SC.SCD.setNameFix(player.getName().substring(0, 15), player.getName());
					sign.setText(3, player.getName().substring(0, 15));
				}
				else{
					sign.setText(3, player.getName());
				}
			}
		}
		else{
			if(!SC.SCD.canPlaceSign(2, player.getName())){
				player.sendMessage("[�ign��s�no] You have too many '�RAPS' signs");
				NoPlaceSign(sign);
				return false;
			}
			if(player.getName().length() > 15){
				SC.SCD.setNameFix(player.getName().substring(0, 15), player.getName());
				sign.setText(3, player.getName().substring(0, 15));
			}
			else{
				sign.setText(3, player.getName());
			}
		}
		sign.setText(0, "�CRAPS]");
		if (!sign.getText(1).equals("")) {
			try {
				line2string = sign.getText(1);
				line2 = Double.parseDouble(line2string);
			}catch (NumberFormatException NFE) {
				if(SCD.dCo){
					player.sendMessage("[�ign��s�no]�Invalid '�ET�. Auto-setting 'BET' to '�+SCD.priceForm(SCD.AB)+"�");
					sign.setText(1, "�+SCD.priceForm(SCD.AB));
				}
				else{
					player.sendMessage("[�ign��s�no]�Invalid '�ET�. Auto-setting 'BET' to '�+((int)SCD.AB)+"�");
					sign.setText(1, "�+((int)SCD.AB));
				}
			}
 public boolean onCommand(Player player, String[] split) {
   if (!player.canUseCommand(split[0])) {
     return false;
   }
   if (split[0].equalsIgnoreCase("/saveStargate")) {
     if (split.length == 5) {
       StargateData.Savestargate(player, split);
     }
     return true;
   } else if (split[0].equalsIgnoreCase("/listStargates")) {
     // world.setBlockAt(20,(int)Math.floor(player.getX()),(int)Math.floor(player.getY()),(int)Math.floor(player.getZ()));
     return true;
   } else if (split[0].equalsIgnoreCase("/removeStargate")) {
     boolean worked = false;
     if (split.length > 1) {}
     if (worked) {
       player.sendMessage("Stargate removed");
     } else {
       player.sendMessage("Failed to remove Stargate");
     }
     return true;
   } else {
     return false;
   }
 }
 public boolean onBlockCreate(
     Player player, Block blockPlaced, Block blockClicked, int itemInHand) {
   if ((itemInHand == 283) && player.canUseCommand("/saveStargate")) {
     Integer whichPoint =
         StargateData.setPoint(
             player.getName(), blockClicked.getX(), blockClicked.getY(), blockClicked.getZ());
     if (whichPoint == 2) {
       player.sendMessage("First corner of teleport area set");
     } else if (whichPoint == 3) {
       player.sendMessage("Second corner of teleport area set");
     } else if (whichPoint == 4) {
       player.sendMessage("First corner of landing area set");
     } else {
       player.sendMessage("Second corner of landing area set");
     }
     return true;
   }
   return false;
 }
    public boolean onCommand(Player player, String[] split) {
      if (!player.canUseCommand(split[0])) return false;
      if (split[0].equalsIgnoreCase("/ion_cannon")) {
        if (cannons.containsKey(player.getName())) {
          player.sendMessage("Ion Cannon has been disabled.");
          cannons.remove(player.getName());
        } else {
          int size = 3;
          if (split.length > 1) size = Integer.parseInt(split[1]);
          if (size < 1) size = 1;
          player.sendMessage(" :: WARNING :: ION CANNON LOADED");
          player.sendMessage(" :: WARNING :: BEAM SIZE: " + size);

          cannons.put(player.getName(), size);
        }
        return true;
      }
      return false;
    }
 public void onArmSwing(Player player) {
   // If holding a block, left click to place anywhere!
   if ((player.canUseCommand("/ion_cannon")) && (cannons.containsKey(player.getName()))) {
     HitBlox blox = new HitBlox(player);
     Block block = blox.getTargetBlock();
     if (block == null) return;
     player.sendMessage("BOOM");
     int size = ((Integer) cannons.get(player.getName())).intValue();
     cannons.remove(player.getName());
     // int beamType = 1;
     int beamType = 46;
     int borderType = 57;
     // int i = block.getY();
     for (int i = 0; i < 128; i++) {
       circleMidpoint(block.getX(), block.getZ(), size, i, borderType);
       circleMidpoint(block.getX(), block.getZ(), size - 1, i, beamType);
     }
     circleMidpoint(block.getX(), block.getZ(), size, 0, 7);
     cylinderModpoint(block.getX(), block.getZ(), size + 1, 0, 7);
     etc.getServer().setBlockAt(51, block.getX(), 127, block.getZ());
   }
 }
Exemple #6
0
 /**
  * Determines if a player used a command AND can use it.
  *
  * @param String - The command being checked.
  * @param String - What the player is trying to use.
  * @param Player - The player attempting to use the command.
  */
 public boolean isApt(String apt, String input, Player heir) {
   return (heir.canUseCommand(apt) && input.equalsIgnoreCase(apt));
 }