예제 #1
0
 public PartyInstance(PartyType type, String name, String abbr, String creator) {
   this.type = type;
   this.name = name;
   this.abbr = abbr;
   this.leader = creator;
   this.players = new ArrayList<String>();
   this.players.add(leader);
   this.server = PartyMan.getPartyMan().getServer();
   this.pvpEnabled = true;
   String parent = PartyMan.getPartyMan().getConfiguration().getString("partyman.parentgroup");
   pexgroup = parent + "_" + name.toLowerCase();
   String prefix = PartyMan.getPartyMan().getConfiguration().getString("partyman.group.prefix");
   String suffix = PartyMan.getPartyMan().getConfiguration().getString("partyman.group.suffix");
   server.dispatchCommand(server.getConsoleSender(), "pex group " + pexgroup + " create");
   server.dispatchCommand(
       server.getConsoleSender(), "pex group " + pexgroup + " parents set " + parent);
   server.dispatchCommand(
       server.getConsoleSender(), "pex group " + pexgroup + " prefix " + prefix + abbr + suffix);
   server.dispatchCommand(
       server.getConsoleSender(), "pex group " + pexgroup + " user add " + leader);
   sendPlayerMessage(leader, "Party created. Start inviting others!");
   PartyMan.getPartyMan().getSavedParties().createSection("parties." + name);
   PartyMan.getPartyMan().getSavedParties().set("parties." + name + ".abbr", abbr);
   PartyMan.getPartyMan().getSavedParties().set("parties." + name + ".leader", leader);
   Boolean chatMode =
       PartyMan.getPartyMan().getSavedParties().getBoolean("players." + leader + ".chat");
   if (chatMode == null) {
     chatMode = false;
   }
   PartyMan.getPartyMan().getSavedParties().createSection("players." + leader);
   PartyMan.getPartyMan().getSavedParties().set("players." + leader + ".party", this.name);
   PartyMan.getPartyMan().getPartyManager().setPartyChatMode(leader, chatMode);
   PartyMan.getPartyMan().saveConfigs();
 }
예제 #2
0
 public final synchronized void addPlayer(String player) {
   if (player == null) {
     return;
   }
   if (players.size()
       >= PartyMan.getPartyMan().getConfiguration().getInt("partyman.max-members", 3)) {
     sendPartyMessage("Maximum member limit reached!");
     sendPlayerMessage(player, "Maximum member limit reached!");
     return;
   }
   if (!this.players.contains(player)) {
     sendPartyMessage(getColoredName(player) + " joined the party.");
     sendPlayerMessage(
         player,
         colorizeMessage(
             getPartyMessagePrefix() + " you joined the party. " + getPartyMessageSuffix()));
     server.dispatchCommand(
         server.getConsoleSender(), "pex group " + pexgroup + " user add " + player);
     this.players.add(player);
     Boolean chatMode =
         PartyMan.getPartyMan().getSavedParties().getBoolean("players." + player + ".chat");
     if (chatMode == null) {
       chatMode = false;
     }
     PartyMan.getPartyMan().getSavedParties().createSection("players." + player);
     PartyMan.getPartyMan().getSavedParties().set("players." + player + ".party", this.name);
     PartyMan.getPartyMan().getPartyManager().setPartyChatMode(player, chatMode);
     PartyMan.getPartyMan().saveConfigs();
   }
 }
예제 #3
0
	@Override
	public void run()
	{
		if (!active.compareAndSet(false, true))
		{
			return;
		}

		final ISettings settings = ess.getSettings();

		final net.ess3.settings.Backup backupSettings = settings.getData().getGeneral().getBackup();

		String backupCommand = backupSettings.getCommand() == null || backupSettings.getCommand().isEmpty() ? ("NORUN") : backupSettings.getCommand();
		
		/*if (backupCommand.equals("NORUN")) { TODO: Un-comment if you do not want commands to be run if there is no backup command
			return;
		}*/

		ess.getLogger().log(Level.INFO, _("backupStarted"));

		if (!backupSettings.getCommandsBeforeBackup().isEmpty())
		{
			final CommandSender consoleSender = server.getConsoleSender();
			for (String command : backupSettings.getCommandsBeforeBackup())
			{
				server.dispatchCommand(consoleSender, command);
			}
		}

		ess.getPlugin().scheduleAsyncDelayedTask(new BackupRunner(backupCommand));
	}
예제 #4
0
 public synchronized void clearParty() {
   sendPartyMessage("Party is being disbanded.");
   for (String player : players) {
     PartyMan.getPartyMan().getSavedParties().set("players." + player.toLowerCase(), null);
   }
   this.players.clear();
   PartyMan.getPartyMan().getSavedParties().set("parties." + name, null);
   server.dispatchCommand(server.getConsoleSender(), "pex group " + pexgroup + " delete");
   PartyMan.getPartyMan().saveConfigs();
 }
예제 #5
0
  public void runCommand(String... obj) {
    StringBuilder command = new StringBuilder();
    for (String s : obj) {
      command.append(s);
    }

    String cmd = command.toString();

    outLog.info("Command run by remote user: '******'");

    Server.dispatchCommand(getServer().getConsoleSender(), cmd);
  }
예제 #6
0
 public synchronized void removePlayer(String player, boolean kicked) {
   if (player == null) {
     return;
   }
   if (!this.players.contains(player)) {
     return;
   }
   this.players.remove(player);
   if (this.leader.equals(player)) {
     setPartyLeader(this.players.get(0));
   }
   server.dispatchCommand(
       server.getConsoleSender(), "pex group " + pexgroup + " user remove " + player);
   if (!kicked) {
     sendPartyMessage(getColoredName(player) + " left the party.");
     sendPlayerMessage(player, "You left the party.");
   } else {
     sendPartyMessage(getColoredName(player) + " was kicked from the party.");
     sendPlayerMessage(player, "You were kicked from the party.");
   }
   PartyMan.getPartyMan().getSavedParties().set("players." + player, null);
   PartyMan.getPartyMan().saveConfigs();
 }
예제 #7
0
 @Override
 public boolean dispatchCommand(CommandSender sender, String commandLine) throws CommandException {
   return server.dispatchCommand(sender, commandLine);
 }
예제 #8
0
 public synchronized void shutdownDisband() {
   this.players.clear();
   server.dispatchCommand(server.getConsoleSender(), "pex group " + pexgroup + " delete");
 }