geforkt von Mirrors/Paper
[Bleeding] Blacklist certain plugin names
By: t00thpick1 <t00thpick1dirko@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
4d3aba0a11
Commit
e833c88a72
@ -207,7 +207,7 @@ public final class PluginDescriptionFile {
|
|||||||
* @param mainClass Full location of the main class of this plugin
|
* @param mainClass Full location of the main class of this plugin
|
||||||
*/
|
*/
|
||||||
public PluginDescriptionFile(final String pluginName, final String pluginVersion, final String mainClass) {
|
public PluginDescriptionFile(final String pluginName, final String pluginVersion, final String mainClass) {
|
||||||
name = pluginName;
|
name = pluginName.replace(' ', '_');
|
||||||
version = pluginVersion;
|
version = pluginVersion;
|
||||||
main = mainClass;
|
main = mainClass;
|
||||||
}
|
}
|
||||||
@ -801,6 +801,7 @@ public final class PluginDescriptionFile {
|
|||||||
if (!name.matches("^[A-Za-z0-9 _.-]+$")) {
|
if (!name.matches("^[A-Za-z0-9 _.-]+$")) {
|
||||||
throw new InvalidDescriptionException("name '" + name + "' contains invalid characters.");
|
throw new InvalidDescriptionException("name '" + name + "' contains invalid characters.");
|
||||||
}
|
}
|
||||||
|
name = name.replace(' ', '_');
|
||||||
} catch (NullPointerException ex) {
|
} catch (NullPointerException ex) {
|
||||||
throw new InvalidDescriptionException(ex, "name is not defined");
|
throw new InvalidDescriptionException(ex, "name is not defined");
|
||||||
} catch (ClassCastException ex) {
|
} catch (ClassCastException ex) {
|
||||||
|
@ -131,6 +131,11 @@ public final class SimplePluginManager implements PluginManager {
|
|||||||
PluginDescriptionFile description = null;
|
PluginDescriptionFile description = null;
|
||||||
try {
|
try {
|
||||||
description = loader.getPluginDescription(file);
|
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) {
|
} catch (InvalidDescriptionException ex) {
|
||||||
server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
||||||
continue;
|
continue;
|
||||||
@ -337,7 +342,7 @@ public final class SimplePluginManager implements PluginManager {
|
|||||||
* @return Plugin if it exists, otherwise null
|
* @return Plugin if it exists, otherwise null
|
||||||
*/
|
*/
|
||||||
public synchronized Plugin getPlugin(String name) {
|
public synchronized Plugin getPlugin(String name) {
|
||||||
return lookupNames.get(name);
|
return lookupNames.get(name.replace(' ', '_'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Plugin[] getPlugins() {
|
public synchronized Plugin[] getPlugins() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren