예제 #1
0
 public void setLeave(Region r, String region, String[] message, RegiosPlayer p) {
   String builder = "";
   for (int index = 2; index < message.length; index++) {
     builder += message[index] + " ";
   }
   if (r == null) {
     p.sendMessage(
         ChatColor.RED
             + "[Regios] The region "
             + ChatColor.BLUE
             + region
             + ChatColor.RED
             + " doesn't exist!");
     return;
   } else {
     if (!r.canModify(p)) {
       p.sendMessage(ChatColor.RED + "[Regios] You are not permitted to modify this region!");
       return;
     }
     p.sendMessage(
         ChatColor.GREEN
             + "[Regios] Spout Leave message updated for region "
             + ChatColor.BLUE
             + region);
   }
   mutable.editLeaveMessage(r, builder);
 }
예제 #2
0
 public void setUseLeave(Region r, String region, String input, RegiosPlayer p) {
   boolean val;
   try {
     val = Boolean.parseBoolean(input);
   } catch (Exception bfe) {
     p.sendMessage(ChatColor.RED + "[Regios] The value for the 2nd paramteter must be boolean!");
     return;
   }
   if (r == null) {
     p.sendMessage(
         ChatColor.RED
             + "[Regios] The region "
             + ChatColor.BLUE
             + region
             + ChatColor.RED
             + " doesn't exist!");
     return;
   } else {
     if (!r.canModify(p)) {
       p.sendMessage(ChatColor.RED + "[Regios] You are not permitted to modify this region!");
       return;
     }
     if (val) {
       p.sendMessage(
           ChatColor.GREEN + "[Regios] Leave Popup enabled for region " + ChatColor.BLUE + region);
     } else {
       p.sendMessage(
           ChatColor.GREEN
               + "[Regios] Leave Popup disabled for region "
               + ChatColor.BLUE
               + region);
     }
   }
   mutable.editLeaveEnabled(r, val);
 }
예제 #3
0
 public void setAddMusic(Region r, String region, String message, RegiosPlayer p) {
   try {
     URL u = new URL(message);
     HttpURLConnection huc = (HttpURLConnection) u.openConnection();
     HttpURLConnection.setFollowRedirects(false);
     huc.setRequestMethod("HEAD");
     huc.connect();
     if (huc.getResponseCode() != HttpURLConnection.HTTP_OK) {
       p.sendMessage(ChatColor.RED + "[Regios] URL does not exist!");
       return;
     }
   } catch (MalformedURLException murlex) {
     p.sendMessage(ChatColor.RED + "[Regios] Invalid URL Format!");
     return;
   } catch (IOException e) {
     e.printStackTrace();
     return;
   }
   if (r == null) {
     p.sendMessage(
         ChatColor.RED
             + "[Regios] The region "
             + ChatColor.BLUE
             + region
             + ChatColor.RED
             + " doesn't exist!");
     return;
   } else {
     if (!r.canModify(p)) {
       p.sendMessage(ChatColor.RED + "[Regios] You are not permitted to modify this region!");
       return;
     }
     boolean match = false;
     for (String s : r.getCustomSoundUrl()) {
       if (s.trim().equalsIgnoreCase(message.trim())) {
         match = true;
       }
     }
     if (match) {
       p.sendMessage(
           ChatColor.RED
               + "[Regios] The URL "
               + ChatColor.BLUE
               + message
               + ChatColor.RED
               + " already exists!");
       return;
     }
     p.sendMessage(
         ChatColor.GREEN + "[Regios] Spout Music URL added to region " + ChatColor.BLUE + region);
   }
   mutable.editAddToMusicList(r, message);
 }
예제 #4
0
 public void setWelcomeMaterial(Region r, String region, String input, RegiosPlayer p) {
   int val;
   try {
     val = Integer.parseInt(input);
   } catch (Exception bfe) {
     p.sendMessage(
         ChatColor.RED + "[Regios] The value for the 2nd paramteter must be an integer!");
     return;
   }
   if (!(val >= 0 && val <= 96) && !(val >= 256 && val <= 359) && val != 2256 && val != 2257) {
     p.sendMessage(
         ChatColor.RED
             + "[Regios] Invalid Item ID of "
             + ChatColor.RED
             + val
             + ChatColor.RED
             + "!");
     return;
   }
   if (r == null) {
     p.sendMessage(
         ChatColor.RED
             + "[Regios] The region "
             + ChatColor.BLUE
             + region
             + ChatColor.RED
             + " doesn't exist!");
     return;
   } else {
     if (!r.canModify(p)) {
       p.sendMessage(ChatColor.RED + "[Regios] You are not permitted to modify this region!");
       return;
     }
     p.sendMessage(
         ChatColor.GREEN
             + "[Regios] Welcome Material for region "
             + ChatColor.BLUE
             + region
             + ChatColor.GREEN
             + " set to "
             + ChatColor.BLUE
             + RegiosConversions.getMaterialName(val));
     mutable.editWelcomeMaterial(r, val);
   }
 }
예제 #5
0
 public void setTexturePackURL(Region r, String region, String message, RegiosPlayer p) {
   try {
     URL u = new URL(message);
     HttpURLConnection huc = (HttpURLConnection) u.openConnection();
     HttpURLConnection.setFollowRedirects(false);
     huc.setRequestMethod("HEAD");
     huc.connect();
     if (huc.getResponseCode() != HttpURLConnection.HTTP_OK) {
       p.sendMessage(ChatColor.RED + "[Regios] URL does not exist!");
       return;
     }
   } catch (MalformedURLException murlex) {
     p.sendMessage(ChatColor.RED + "[Regios] Invalid URL Format!");
     return;
   } catch (IOException e) {
     e.printStackTrace();
     return;
   }
   if (r == null) {
     p.sendMessage(
         ChatColor.RED
             + "[Regios] The region "
             + ChatColor.BLUE
             + region
             + ChatColor.RED
             + " doesn't exist!");
     return;
   } else {
     if (!r.canModify(p)) {
       p.sendMessage(ChatColor.RED + "[Regios] You are not permitted to modify this region!");
       return;
     }
     p.sendMessage(
         ChatColor.GREEN
             + "[Regios] Spout Texture Pack updated for region "
             + ChatColor.BLUE
             + region);
   }
   mutable.editTexturePackURL(r, message);
 }
예제 #6
0
 public void setRemoveMusic(Region r, String region, String message, RegiosPlayer p) {
   if (r == null) {
     p.sendMessage(
         ChatColor.RED
             + "[Regios] The region "
             + ChatColor.BLUE
             + region
             + ChatColor.RED
             + " doesn't exist!");
     return;
   } else {
     if (!r.canModify(p)) {
       p.sendMessage(ChatColor.RED + "[Regios] You are not permitted to modify this region!");
       return;
     }
     boolean match = false;
     for (String s : r.getCustomSoundUrl()) {
       if (s.trim().equalsIgnoreCase(message.trim())) {
         match = true;
       }
     }
     if (!match) {
       p.sendMessage(
           ChatColor.RED
               + "[Regios] The URL "
               + ChatColor.BLUE
               + message
               + ChatColor.RED
               + " does not exist!");
       return;
     }
     p.sendMessage(
         ChatColor.GREEN
             + "[Regios] Spout Music URL removed from region "
             + ChatColor.BLUE
             + region);
   }
   mutable.editRemoveFromMusicList(r, message);
 }
예제 #7
0
 public void setResetMusic(Region r, String region, String message, RegiosPlayer p) {
   if (r == null) {
     p.sendMessage(
         ChatColor.RED
             + "[Regios] The region "
             + ChatColor.BLUE
             + region
             + ChatColor.RED
             + " doesn't exist!");
     return;
   } else {
     if (!r.canModify(p)) {
       p.sendMessage(ChatColor.RED + "[Regios] You are not permitted to modify this region!");
       return;
     }
     p.sendMessage(
         ChatColor.GREEN
             + "[Regios] Spout Music URL'S reset for region "
             + ChatColor.BLUE
             + region);
   }
   mutable.editResetMusicList(r);
 }