Are you sure you have to ids set right or does your isMember = the same as your staff rights?
|
I want to add a donator zone, which any donator can teleport too. However the problem i'm having at the moment is that, when I try to add new commands so that donators are able to teleport to the dzone. It doesn't work at all for the donators however it does work for staff members.
Code:if (command[0].equals("dzone")) { if (command.length > 1 && command[1].equals("all")) { for (Player players : World.getPlayers()) { if (players != null) { if (players.getRights().isMember()) { TeleportHandler.teleportPlayer(players, new Position(3094, 3503, 0), TeleportType.NORMAL); } } } } else { TeleportHandler.teleportPlayer(player, new Position(3094, 3503, 0), TeleportType.NORMAL); } }
Are you sure you have to ids set right or does your isMember = the same as your staff rights?
players.getRights().isMember()
post the isMember() method, but from what i remember its suppose to be something like
player.getRights().BRONZE_MEMBER or something liek that, (Removed ruse from my eclipse, not re loading it in.)
I don't know where exactly the isMember() is located since i'm using notepad ++, so Im not sure if that is the correct code you are looking for.Code:public enum PlayerRights { /* * A regular member of the server. */ PLAYER(-1, null, 1, 1), /* * A moderator who has more privilege than other regular members and donators. */ MODERATOR(-1, "<col=20B2AA><shad=0>", 1, 1), /* * The second-highest-privileged member of the server. */ ADMINISTRATOR(-1, "<col=FFFF64><shad=0>", 1, 1), /* * The highest-privileged member of the server */ OWNER(-1, "<col=B40404>", 1, 1), /* * The Developer of the server, has same rights as the owner. */ DEVELOPER(-1, "<shad=B40404>", 1, 1), /* * A member who has donated to the server. */ BRONZE_MEMBER(60, "<shad=FF7F00>", 1.5, 1), SILVER_MEMBER(40, "<shad=0><col=787878>", 1.5, 1.25), GOLD_MEMBER(20, "<col=D9D919><shad=0>", 2, 1.5), PLATINUM_MEMBER(10, "<shad=697998>", 2.5, 1.7), DIAMOND_MEMBER(0, "<shad=0EBFE9>", 3, 2), /* * A member who has the ability to help people better. */ SUPPORT(-1, "<col=FF0000><shad=0>", 1, 1), /* * A member who has been with the server for a long time. */ VETERAN(30, "<col=CD661D>", 1, 1); PlayerRights(int yellDelaySeconds, String yellHexColorPrefix, double loyaltyPointsGainModifier, double experienceGainModifier) { this.yellDelay = yellDelaySeconds; this.yellHexColorPrefix = yellHexColorPrefix; this.loyaltyPointsGainModifier = loyaltyPointsGainModifier; this.experienceGainModifier = experienceGainModifier; } private static final ImmutableSet<PlayerRights> STAFF = Sets.immutableEnumSet(SUPPORT, MODERATOR, ADMINISTRATOR, OWNER, DEVELOPER); private static final ImmutableSet<PlayerRights> MEMBERS = Sets.immutableEnumSet(BRONZE_MEMBER, SILVER_MEMBER, GOLD_MEMBER, PLATINUM_MEMBER, DIAMOND_MEMBER); /* * The yell delay for the rank * The amount of seconds the player with the specified rank must wait before sending another yell message. */ private int yellDelay; private String yellHexColorPrefix; private double loyaltyPointsGainModifier; private double experienceGainModifier; public int getYellDelay() { return yellDelay; } /* * The player's yell message prefix. * Color and shadowing. */ public String getYellPrefix() { return yellHexColorPrefix; } /** * The amount of loyalty points the rank gain per 4 seconds */ public double getLoyaltyPointsGainModifier() { return loyaltyPointsGainModifier; } public double getExperienceGainModifier() { return experienceGainModifier; } public boolean isStaff() { return STAFF.contains(this); } public boolean isMember() { return MEMBERS.contains(this); } /** * Gets the rank for a certain id. * * @param id The id (ordinal()) of the rank. * @return rights. */ public static PlayerRights forId(int id) { for (PlayerRights rights : PlayerRights.values()) { if (rights.ordinal() == id) { return rights; } } return null; } }
i found it
so
This should work.Code:private static final ImmutableSet<PlayerRights> MEMBERS = Sets.immutableEnumSet(BRONZE_MEMBER, SILVER_MEMBER, GOLD_MEMBER, PLATINUM_MEMBER, DIAMOND_MEMBER);
put it underCode:private static void memberCommandsCode:if (command[0].equals("dzone")) { if (command.length > 1 && command[1].equals("all")) { for (Player players : World.getPlayers()) { if (players != null) { if (players.getRights().isMember()) { TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL); } } } } }
I have addedI have put it under the membercommands section however it still doesn't work for any donator ranks.Code:if (command[0].equals("dzone")) { if (command.length > 1 && command[1].equals("all")) { for (Player players : World.getPlayers()) { if (players != null) { if (players.getRights().isMember()) { TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL); } } } } }
This is not how u do it, + if the user who wishes to teleport to the donatorzone, he can teleport all members to the donatorzone aswell, you took that from an other staff command i believe so
I changed the codeI got this error from changing the codeCode:private static void memberCommands(final Player player, String[] command, String wholeCommand) { if (command[0].equals("dzone")) { if (players.getRights().isMember()) { TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL); } }
Try removing a brace from the command.
So maybe like?
If it doesn't work like that, pm me your Skype and I'll teamviewer you and fix it myself.Code:private static void memberCommands(final Player player, String[] command, String wholeCommand) { if (command[0].equals("dzone")) { if (players.getRights().isMember()) { TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL); }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |