Fix broken transitive dependencies by removing broken showcasestandalone support

System paths don't work so well.
This commit is contained in:
Irmo van den Berge committed 2018-11-20 23:27:48 +01:00
1 parent 2f8af12a37
commit 4c61f956d0
5 files changed
+4 -135

No files matched your search

Binary file not shown.
+1 -8
View File
@@ -175,14 +175,7 @@
</exclusion>
</exclusions>
</dependency>
<!-- SCS hook -->
<dependency>
<groupId>com.kellerkindt</groupId>
<artifactId>ShowCaseStandalone</artifactId>
<version>695</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ShowCaseStandalone.jar</systemPath>
</dependency>
<!-- ProtocolLib hook -->
<dependency>
<groupId>com.comphenix.protocol</groupId>
@@ -1,103 +0,0 @@
package com.bergerkiller.bukkit.common.internal;
import com.bergerkiller.bukkit.common.Logging;
import com.bergerkiller.bukkit.common.filtering.Filter;
import com.kellerkindt.scs.ShowCaseStandalone;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.plugin.Plugin;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
public class CommonEntityBlacklist implements Filter<Entity> {
private final List<BlacklistFilter> availableFilters = new ArrayList<BlacklistFilter>();
public CommonEntityBlacklist() {
// ===============================================
// ==== Initialize all available filters here ====
// ===============================================
// Showcase Standalone
availableFilters.add(new BlacklistFilter("ShowCaseStandalone") {
@Override
public boolean isFiltered(Entity element) {
if (element instanceof Item) {
ShowCaseStandalone plugin = (ShowCaseStandalone) getPlugin();
return plugin.getShopHandler().isShopItem((Item) element);
}
return false;
}
});
}
public void updateDependency(Plugin plugin, String pluginName, boolean enabled) {
for (BlacklistFilter filter : this.availableFilters) {
if (filter.matchPlugin(pluginName)) {
filter.trySetEnabled(plugin, enabled);
}
}
}
@Override
public boolean isFiltered(Entity element) {
for (BlacklistFilter filter : this.availableFilters) {
try {
if (filter.isEnabled() && filter.isFiltered(element)) {
return true;
}
} catch (Throwable t) {
Logging.LOGGER.log(Level.SEVERE, filter.getPluginName()
+ " entity filter verification failed (update needed?), contact the authors!");
filter.trySetEnabled(filter.getPlugin(), false);
}
}
return false;
}
private static abstract class BlacklistFilter implements Filter<Entity> {
private final String pluginName;
private boolean enabled = false;
private Plugin pluginInstance = null;
public BlacklistFilter(String pluginName) {
this.pluginName = pluginName;
}
public void trySetEnabled(Plugin plugin, boolean enabled) {
this.enabled = enabled;
try {
onEnabledChange(plugin, enabled);
if (enabled) {
Logging.LOGGER.log(Level.INFO, pluginName + " detected: Items belonging to this plugin will be ignored");
}
} catch (Throwable t) {
Logging.LOGGER.log(Level.SEVERE, "Error while " + (enabled ? "adding" : "removing")
+ " item ignore support for " + pluginName, t);
}
this.pluginInstance = enabled ? plugin : null;
}
public void onEnabledChange(Plugin plugin, boolean enabled) {
}
public boolean isEnabled() {
return this.enabled;
}
public String getPluginName() {
return pluginName;
}
public Plugin getPlugin() {
return pluginInstance;
}
public boolean matchPlugin(String pluginName) {
return pluginName.equals(this.pluginName);
}
}
}
@@ -77,7 +77,6 @@ public class CommonPlugin extends PluginBase {
private PermissionHandler permissionHandler = null;
private CommonTabController tabController = null;
private CommonMapController mapController = null;
private CommonEntityBlacklist entityBlacklist = null;
private CommonImmutablePlayerSetManager immutablePlayerSetManager = null;
private CommonChunkLoaderPool chunkLoaderPool = null;
@@ -204,17 +203,6 @@ public class CommonPlugin extends PluginBase {
}
}
/**
* Obtains the Entity Blacklist that filters out Entities that are part of
* other plugin's logic. This includes entities that represent particles or
* virtual items.
*
* @return entity blacklist
*/
public CommonEntityBlacklist getEntityBlacklist() {
return entityBlacklist;
}
/**
* Obtains the Tab Controller that is responsible for the creation and
* updating of tabs
@@ -340,7 +328,6 @@ public class CommonPlugin extends PluginBase {
packetHandler.removePacketListeners(plugin);
}
this.mapController.updateDependency(plugin, pluginName, enabled);
this.entityBlacklist.updateDependency(plugin, pluginName, enabled);
this.permissionHandler.updateDependency(plugin, pluginName, enabled);
if (!this.updatePacketHandler()) {
this.onCriticalFailure();
@@ -521,9 +508,6 @@ public class CommonPlugin extends PluginBase {
// Initialize entity map (needs to be here because of CommonPlugin instance needed)
playerVisibleChunks = new EntityMap<Player, CommonPlayerMeta>();
// Initialize Entity Blacklist
entityBlacklist = new CommonEntityBlacklist();
// Register events and tasks, initialize
register(listener = new CommonListener());
@@ -5,7 +5,6 @@ import com.bergerkiller.bukkit.common.conversion.Conversion;
import com.bergerkiller.bukkit.common.conversion.type.HandleConversion;
import com.bergerkiller.bukkit.common.entity.CommonEntity;
import com.bergerkiller.bukkit.common.internal.CommonNMS;
import com.bergerkiller.bukkit.common.internal.CommonPlugin;
import com.bergerkiller.bukkit.common.wrappers.DataWatcher;
import com.bergerkiller.generated.net.minecraft.server.EntityHandle;
import com.bergerkiller.generated.net.minecraft.server.EntityHangingHandle;
@@ -90,15 +89,11 @@ public class EntityUtil extends EntityPropertyUtil {
}
/**
* Checks whether a given Entity should be ignored when working with it<br>
* This could be because another plugin is operating on it, or for Virtual
* items
*
* @param entity to check
* @return True if the entity should be ignored, False if not
* <b>Deprecated: there are no plans to support this</b>
*/
@Deprecated
public static boolean isIgnored(org.bukkit.entity.Entity entity) {
return CommonPlugin.getInstance().getEntityBlacklist().isFiltered(entity);
return false;
}
/*