Package com.sijobe.spc.util

Examples of com.sijobe.spc.util.Settings


    */
   public void setWaypoint(String name, Player player) {
      if (name == null || player == null) {
         return;
      }
      Settings config = super.loadSettings(player);
      Coordinate position = player.getPosition();
      String value = position.getX() + "," +
                     position.getY() + "," +
                     position.getZ() + "," +
                     player.getYaw() + "," +
                     player.getPitch();
      config.set((PREFIX + name).toLowerCase(), value);
   }
View Full Code Here


    */
   public boolean removeWaypoint(String name, Player player) {
      if (name == null || player == null) {
         return false;
      }
      Settings config = super.loadSettings(player);
      return config.remove((PREFIX + name).toLowerCase()) != null;
   }
View Full Code Here

  
   public boolean gotoWaypoint(String name, Player player) {
      if (name == null || player == null) {
         return false;
      }
      Settings config = super.loadSettings(player);
      String waypoint = config.getString((PREFIX + name).toLowerCase(), null);
      if (waypoint == null) {
         return false;
      }
      String parts[] = waypoint.split(",");
      if (parts.length != 5) {
View Full Code Here

   private static final int MAX_AIR = 300;

   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = super.getSenderAsPlayer(sender);
      Settings config = super.loadSettings(player);
      boolean value = config.getBoolean("scuba", false);
      if (params.size() > 0) {
         value = !(Boolean)params.get(0);
      }
      if (!value) {
         config.set("scuba", true);
         player.sendChatMessage("Scuba mode is " + FontColour.AQUA + "enabled");
      } else {
         config.set("scuba", false);
         player.sendChatMessage("Scuba mode is " + FontColour.AQUA + "disabled");
      }
      config.save();
   }
View Full Code Here

  }

   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = CommandBase.getSenderAsPlayer(sender);
      Settings config = super.loadSettings(player);
      boolean prefixSlash = config.getBoolean("prefixSlash", true);
      if (params.size() == 0) {
         prefixSlash ^= true;
      } else {
         prefixSlash = ((Boolean)params.get(0));
      }
      config.set("prefixSlash", prefixSlash);
      super.saveSettings(player);
      player.sendChatMessage("Slash prefixing is now " + FontColour.AQUA
               + (prefixSlash ? "enabled" : "disabled"));
   }
View Full Code Here

   /**
    * @see com.sijobe.spc.wrapper.CommandBase#execute(com.sijobe.spc.wrapper.CommandSender, java.util.List)
    */
   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Settings config = super.loadSettings(super.getSenderAsPlayer(sender));
      if (((String)params.get(0)).equalsIgnoreCase("reset")) {
         config.set(CONFIG_KEY, DEFAULT_SPEED);
      } else {
         try {
            config.set(CONFIG_KEY, Double.parseDouble((String)params.get(0)));
         } catch (Exception e) {
            throw new CommandException("Could not parse " + (String)params.get(0) + " as a speed.");
         }
      }
      config.save();
      sender.sendMessageToPlayer("Player speed set to " + FontColour.AQUA
               + config.getDouble(CONFIG_KEY, DEFAULT_SPEED) + FontColour.WHITE + "x normal speed");
      }
View Full Code Here

   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = super.getSenderAsPlayer(sender);
      if(player.getMinecraftPlayer() instanceof EntityPlayerMP) {
         Settings config = super.loadSettings(player);
         boolean instantMine = config.getBoolean("instantMine", false);
         if (params.size() == 0) {
            instantMine ^= true;
         } else {
            instantMine = ((Boolean)params.get(0));
         }
         config.set("instantMine", instantMine);
         super.saveSettings(player);
         player.sendChatMessage("Instant mining " + (instantMine?"enabled.":"disabled."));
      } else {
         throw new CommandException("Non-client command");
      }
View Full Code Here

TOP

Related Classes of com.sijobe.spc.util.Settings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.