Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SignJoinJoin extends PluginListener
- {
- int i;
- public boolean onSignChange(Player player, Sign sign)
- {
- Block b = sign.getBlock();
- World world = player.getWorld();
- if ((sign.getText(0).equals("[Join]")) &&
- (player.canUseCommand("/signadmin"))) {
- sign.setText(0, "[Join]");
- if (sign.getText(1).isEmpty()) sign.setText(1, "§4White List");
- if (sign.getText(2).isEmpty()) sign.setText(2, "§4add to Group:");
- if (sign.getText(3).isEmpty()) sign.setText(3, "default");
- player.sendMessage("§2Sign sucsessfully created.");
- return false;
- }
- if (sign.getText(0).equals("[Caste]")) {
- if ((!player.canUseCommand("/signadmin")) ||
- (sign.getText(1).isEmpty())) { player.notify("You have to fill in an group on line 2"); world.setBlockAt(0, sign.getX(), sign.getY(), sign.getZ()); world.dropItem(b.getLocation(), 323); return true; }
- if (!etc.getDataSource().doesGroupExist(sign.getText(1))) { player.notify("The group on line 2 does not exist"); world.setBlockAt(0, sign.getX(), sign.getY(), sign.getZ()); world.dropItem(b.getLocation(), 323); return true; }
- if (sign.getText(2).isEmpty()) { player.notify("You have to fill in an group on line 3"); world.setBlockAt(0, sign.getX(), sign.getY(), sign.getZ()); world.dropItem(b.getLocation(), 323); return true; }
- if (!etc.getDataSource().doesGroupExist(sign.getText(2))) { player.notify("The group on line 3 does not exist"); world.setBlockAt(0, sign.getX(), sign.getY(), sign.getZ()); world.dropItem(b.getLocation(), 323); return true; }
- if (sign.getText(3).isEmpty()) { player.notify("You have to fill in an price on line 4"); world.setBlockAt(0, sign.getX(), sign.getY(), sign.getZ()); world.dropItem(b.getLocation(), 323); return true; } try {
- Double.parseDouble(sign.getText(3)); } catch (NumberFormatException nfe) { player.notify("Line 4 must be an number!"); world.setBlockAt(0, sign.getX(), sign.getY(), sign.getZ()); world.dropItem(b.getLocation(), 323); return true; }
- player.sendMessage("§2Sign sucsessfully created.");
- return false;
- }
- return false;
- }
- public boolean onBlockRightClick(Player player, Block bc, Item iih) {
- if ((bc.getType() == 63) || (bc.getType() == 68)) {
- Sign sign = (Sign)bc.getWorld().getComplexBlock(bc.getX(), bc.getY(), bc.getZ());
- if (sign.getText(0).equalsIgnoreCase("[Join]")) {
- if (player.canUseCommand("/signjoin")) {
- if (!etc.getDataSource().isUserOnWhitelist(player.getName())) {
- if ((player.getGroups()[0].equals("default")) || (player.getGroups()[0].equals("guest"))) {
- player.setGroups(new String[] { sign.getText(3) });
- etc.getDataSource().modifyPlayer(player);
- etc.getDataSource().addToWhitelist(player.getName());
- player.sendMessage("§2Your added to the whitelist and modified.");
- return false;
- }
- player.notify("You are already modified.");
- return true;
- }
- player.notify("You are already on the whitelist");
- }
- else {
- player.notify("You are not allowed to preform this command");
- return true;
- }
- }
- if (sign.getText(0).equals("[Caste]")) {
- if (sign.getText(1).equals(player.getGroups()[0])) {
- double money = ((Double)etc.getLoader().callCustomHook("dCBalance", new Object[] { "Player-Balance", player.getName() })).doubleValue();
- if (money < Double.parseDouble(sign.getText(3))) { player.notify("You dont have enough money to preform this action"); return true; }
- player.setGroups(new String[] { sign.getText(2) });
- etc.getDataSource().modifyPlayer(player);
- etc.getLoader().callCustomHook("dCBalance", new Object[] { "Player-Charge", player.getName(), Double.valueOf(Double.parseDouble(sign.getText(3))) });
- //newcode
- char[] c = sign.getText(2).toCharArray();
- while(!isNumber(c[i])){
- i++;
- }
- player.chat("/teach"+c[i]+" "+player.getName()+" PASS");
- //newcode
- player.sendMessage("§2You Changed from caste");
- return false;
- }
- player.notify("You can not change from your current caste to this caste");
- return true;
- }
- }
- return false;
- }
- public boolean isNumber(char c){try{Integer.parseInt(c+"");}catch(NumberFormatException nfe){return false;}
- return true;}
- }
Advertisement
Add Comment
Please, Sign In to add comment