Small refactor to Plugin sorter
This commit is contained in:
@@ -76,24 +76,23 @@ public class PluginSorterPlugin extends Plugin {
|
|||||||
public void updateColors() {
|
public void updateColors() {
|
||||||
for (PluginListItem pli : ConfigPanel.pluginList) {
|
for (PluginListItem pli : ConfigPanel.pluginList) {
|
||||||
if (pli.getPlugin()!=null) {
|
if (pli.getPlugin()!=null) {
|
||||||
if (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type()!=null)
|
switch (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type()) {
|
||||||
switch (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type()) {
|
case EXTERNAL:
|
||||||
case EXTERNAL:
|
pli.nameLabel.setForeground(config.externalColor());
|
||||||
pli.nameLabel.setForeground(config.externalColor());
|
break;
|
||||||
break;
|
case PVM:
|
||||||
case PVM:
|
pli.nameLabel.setForeground(config.pvmColor());
|
||||||
pli.nameLabel.setForeground(config.pvmColor());
|
break;
|
||||||
break;
|
case PVP:
|
||||||
case PVP:
|
pli.nameLabel.setForeground(config.pvpColor());
|
||||||
pli.nameLabel.setForeground(config.pvpColor());
|
break;
|
||||||
break;
|
case UTILITY:
|
||||||
case UTILITY:
|
pli.nameLabel.setForeground(config.utilityColor());
|
||||||
pli.nameLabel.setForeground(config.utilityColor());
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
pli.nameLabel.setForeground(Color.WHITE);
|
||||||
pli.nameLabel.setForeground(Color.WHITE);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,38 +102,27 @@ public class PluginSorterPlugin extends Plugin {
|
|||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
PluginListItem pli = iter.next();
|
PluginListItem pli = iter.next();
|
||||||
if (pli.getPlugin() != null) {
|
if (pli.getPlugin() != null) {
|
||||||
if (!pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type().equals(""))
|
switch (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type())
|
||||||
if (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type().equals("external")) {
|
{
|
||||||
iter.remove();
|
case PVM:
|
||||||
removedPlugins.add(pli);
|
case PVP:
|
||||||
}
|
case UTILITY:
|
||||||
if (!pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type().equals(""))
|
case EXTERNAL:
|
||||||
if (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type().equals("PVM")) {
|
iter.remove();
|
||||||
iter.remove();
|
removedPlugins.add(pli);
|
||||||
removedPlugins.add(pli);
|
break;
|
||||||
}
|
case GENERAL_USE:
|
||||||
if (!pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type().equals(""))
|
default:
|
||||||
if (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type().equals("PVP")) {
|
break;
|
||||||
iter.remove();
|
}
|
||||||
removedPlugins.add(pli);
|
|
||||||
}
|
|
||||||
if (!pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type().equals(""))
|
|
||||||
if (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type().equals("utility")) {
|
|
||||||
iter.remove();
|
|
||||||
removedPlugins.add(pli);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showPlugins() {
|
public void showPlugins() {
|
||||||
List<PluginListItem> tempList = new ArrayList<>();
|
List<PluginListItem> tempList = new ArrayList<>();
|
||||||
for (PluginListItem pli : removedPlugins) {
|
tempList.addAll(removedPlugins);
|
||||||
tempList.add(pli);
|
tempList.addAll(ConfigPanel.pluginList);
|
||||||
}
|
|
||||||
for (PluginListItem pli : ConfigPanel.pluginList) {
|
|
||||||
tempList.add(pli);
|
|
||||||
}
|
|
||||||
ConfigPanel.pluginList = tempList;
|
ConfigPanel.pluginList = tempList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user