[Bleeding] Blacklist certain plugin names

By: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
Bukkit/Spigot
2014-02-07 20:30:34 -05:00
parent 4d3aba0a11
commit e833c88a72
2 changed files with 8 additions and 2 deletions

View File

@ -131,6 +131,11 @@ public final class SimplePluginManager implements PluginManager {
PluginDescriptionFile description = null;
try {
description = loader.getPluginDescription(file);
String name = description.getName();
if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) {
server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name");
continue;
}
} catch (InvalidDescriptionException ex) {
server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
continue;
@ -337,7 +342,7 @@ public final class SimplePluginManager implements PluginManager {
* @return Plugin if it exists, otherwise null
*/
public synchronized Plugin getPlugin(String name) {
return lookupNames.get(name);
return lookupNames.get(name.replace(' ', '_'));
}
public synchronized Plugin[] getPlugins() {