From 15f47118e8b17afda538a1edd1db2272fa77034d Mon Sep 17 00:00:00 2001 From: Maxim Van de Wynckel Date: Sun, 15 Jun 2014 10:50:27 +0200 Subject: [PATCH] Added + and - before radius as an optional char This allows players to perform time based, vote based or donation based commands to increase the map size. Examples: 1) Player votes, increase the map by 1 block 2) Player joins (more players) increase the map, Player is offline for X days decrease the map 3) Reached donation goal, increase the map --- .../com/wimbli/WorldBorder/cmd/CmdRadius.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/wimbli/WorldBorder/cmd/CmdRadius.java b/src/main/java/com/wimbli/WorldBorder/cmd/CmdRadius.java index bf76124..4ea0060 100644 --- a/src/main/java/com/wimbli/WorldBorder/cmd/CmdRadius.java +++ b/src/main/java/com/wimbli/WorldBorder/cmd/CmdRadius.java @@ -41,9 +41,29 @@ public class CmdRadius extends WBCmd int radiusZ; try { - radiusX = Integer.parseInt(params.get(0)); + if (params.get(0).startsWith('+')){ + // Add to the current radius + radiusX = Config.getBorder(worldName).getRadiusX(); + radiusX += Integer.parseInt(params.get(0).substring(1)); + }else if(params.get(0).startsWith('-')){ + // Subtract from the current radius + radiusX = Config.getBorder(worldName).getRadiusX(); + radiusX -= Integer.parseInt(params.get(0).substring(1)); + }else{ + radiusX = Integer.parseInt(params.get(0)); + } if (params.size() == 2) - radiusZ = Integer.parseInt(params.get(1)); + if (params.get(0).startsWith('+')){ + // Add to the current radius + radiusZ = Config.getBorder(worldName).getRadiusZ(); + radiusZ += Integer.parseInt(params.get(1).substring(1)); + }else if(params.get(0).startsWith('-')){ + // Subtract from the current radius + radiusZ = Config.getBorder(worldName).getRadiusZ(); + radiusZ -= Integer.parseInt(params.get(1).substring(1)); + }else{ + radiusZ = Integer.parseInt(params.get(1)); + } else radiusZ = radiusX; }