Java Code Examples for org.bukkit.event.HandlerList#unregisterAll()

The following examples show how to use org.bukkit.event.HandlerList#unregisterAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SelectorLayout.java    From EchoPet with GNU General Public License v3.0 5 votes vote down vote up
public static void loadLayout() {
    if (selectorMenu != null) {
        HandlerList.unregisterAll(selectorMenu);
    }

    selectorLayout.clear();
    YAMLConfig config = ConfigOptions.instance.getConfig();
    String s = "petSelector.menu";
    int size = config.getInt(s + ".slots");
    for (int i = 1; i <= size; i++) {
        String cmd = config.getString(s + ".slot-" + i + ".command");
        String petType = config.getString(s + ".slot-" + i + ".petType");
        PetType pt = null;
        if (petType != null && GeneralUtil.isEnumType(PetType.class, petType.toUpperCase())) {
            pt = PetType.valueOf(petType.toUpperCase());
        }
        int id = config.getInt(s + ".slot-" + i + ".materialId");
        int data = config.getInt(s + ".slot-" + i + ".materialData");
        String name = config.getString(s + ".slot-" + i + ".name");
        if (name == null) {
            continue;
        }
        List<String> lore = config.config().getStringList(s + ".slot-" + i + ".lore");
        if (lore == null) {
            lore = new ArrayList<String>();
        }
        ArrayList<String> loreList = new ArrayList<String>();
        if (lore.size() > 0) {
            for (String part : lore) {
                loreList.add(ChatColor.translateAlternateColorCodes('&', part));
            }
        }
        selectorLayout.add(new SelectorIcon(i - 1, cmd, pt, id, data, name, loreList.toArray(new String[0])));
    }

    selectorMenu = new SelectorMenu();
}
 
Example 2
Source File: ListeningMapAdapter.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Clear the list and stop listening for events. This map should not be used after this method is called.
 */
public void disable() {
    if(this.enabled) {
        this.clear();
        HandlerList.unregisterAll(this);
    }
}
 
Example 3
Source File: ListeningMapAdapter.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Clear the list and stop listening for events. This map should not be used after this method is
 * called.
 */
public void disable() {
  if (this.enabled) {
    this.clear();
    HandlerList.unregisterAll(this);
  }
}
 
Example 4
Source File: PvPCommand.java    From MarriageMaster with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void close()
{
	if(onCommand != null)
	{
		onCommand.close();
		onCommand = null;
	}
	if(offCommand != null)
	{
		offCommand.close();
		offCommand = null;
	}
	HandlerList.unregisterAll(this);
}
 
Example 5
Source File: Radiation.java    From CraftserveRadiation with Apache License 2.0 5 votes vote down vote up
public void disable() {
    HandlerList.unregisterAll(this);

    if (this.task != null) {
        this.task.cancel();
    }

    if (this.bossBar != null) {
        this.bossBar.removeAll();
    }

    this.affectedPlayers.clear();
}
 
Example 6
Source File: ControlPointMatchModule.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void unload() {
  for (ControlPoint controlPoint : this.controlPoints) {
    controlPoint.unregisterEvents();
  }
  HandlerList.unregisterAll(this.announcer);
}
 
Example 7
Source File: NPCInteractObjective.java    From BetonQuest with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void stop() {
    HandlerList.unregisterAll(this);
}
 
Example 8
Source File: CommandListener.java    From factions-top with MIT License 4 votes vote down vote up
@Override
public void terminate() {
    HandlerList.unregisterAll(this);
}
 
Example 9
Source File: CraftingObjective.java    From BetonQuest with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void stop() {
    HandlerList.unregisterAll(this);
}
 
Example 10
Source File: Blood.java    From CardinalPGM with MIT License 4 votes vote down vote up
@Override
public void unload() {
    HandlerList.unregisterAll(this);
}
 
Example 11
Source File: TeamPicker.java    From CardinalPGM with MIT License 4 votes vote down vote up
@Override
public void unload() {
    HandlerList.unregisterAll(this);
}
 
Example 12
Source File: ToolRepair.java    From CardinalPGM with MIT License 4 votes vote down vote up
@Override
public void unload() {
    HandlerList.unregisterAll(this);
}
 
Example 13
Source File: Net.java    From CardinalPGM with MIT License 4 votes vote down vote up
@Override
public void unload() {
    HandlerList.unregisterAll(this);
}
 
Example 14
Source File: PaperTickReporter.java    From spark with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void close() {
    HandlerList.unregisterAll(this);
}
 
Example 15
Source File: WildCard.java    From CardinalPGM with MIT License 4 votes vote down vote up
@Override
public void unload() {
    HandlerList.unregisterAll(this);
}
 
Example 16
Source File: PetMaster.java    From PetMaster with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Extracts plugin parameters from the configuration file.
 * 
 * @param attemptUpdate
 */
public void extractParametersFromConfig(boolean attemptUpdate) {
	getLogger().info("Backing up and loading configuration files...");

	config = loadAndBackupYamlConfiguration("config.yml");
	lang = loadAndBackupYamlConfiguration(config.getString("languageFileName", "lang.yml"));

	if (!getServer().getPluginManager().isPluginEnabled(this)) {
		return;
	}

	// Update configurations from previous versions of the plugin if server reloads or restarts.
	if (attemptUpdate) {
		updateOldConfiguration();
		updateOldLanguage();
	}

	playerInteractListener.extractParameters();

	if (config.getBoolean("checkForUpdate", true)) {
		if (updateChecker == null) {
			updateChecker = new UpdateChecker(this, "https://raw.githubusercontent.com/PyvesB/PetMaster/master/pom.xml",
					"petmaster.admin", chatHeader, "spigotmc.org/resources/pet-master.15904");
			getServer().getPluginManager().registerEvents(updateChecker, this);
			updateChecker.launchUpdateCheckerTask();
		}
	} else {
		PlayerJoinEvent.getHandlerList().unregister(updateChecker);
		updateChecker = null;
	}

	if (config.getBoolean("disablePlayerDamage", false)) {
		if (playerAttackListener == null) {
			playerAttackListener = new PlayerAttackListener(this);
			getServer().getPluginManager().registerEvents(playerAttackListener, this);
			playerAttackListener.extractParameters();
		}

	} else {
		if (playerAttackListener != null) {
			HandlerList.unregisterAll(playerAttackListener);
			playerAttackListener = null;
		}
	}
}
 
Example 17
Source File: WoolObjective.java    From CardinalPGM with MIT License 4 votes vote down vote up
@Override
public void unload() {
    HandlerList.unregisterAll(this);
}
 
Example 18
Source File: ChatModule.java    From CardinalPGM with MIT License 4 votes vote down vote up
@Override
public void unload() {
    HandlerList.unregisterAll(this);
}
 
Example 19
Source File: PasswordObjective.java    From BetonQuest with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void stop() {
    HandlerList.unregisterAll(this);
}
 
Example 20
Source File: EnchantObjective.java    From BetonQuest with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void stop() {
    HandlerList.unregisterAll(this);
}