mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Cleaning up our listeners, as well as some Spout stuff.
This commit is contained in:
		@@ -28,6 +28,7 @@ import com.gmail.nossr50.listeners.EntityListener;
 | 
				
			|||||||
import com.gmail.nossr50.listeners.InventoryListener;
 | 
					import com.gmail.nossr50.listeners.InventoryListener;
 | 
				
			||||||
import com.gmail.nossr50.listeners.PlayerListener;
 | 
					import com.gmail.nossr50.listeners.PlayerListener;
 | 
				
			||||||
import com.gmail.nossr50.listeners.SelfListener;
 | 
					import com.gmail.nossr50.listeners.SelfListener;
 | 
				
			||||||
 | 
					import com.gmail.nossr50.listeners.SpoutListener;
 | 
				
			||||||
import com.gmail.nossr50.listeners.WorldListener;
 | 
					import com.gmail.nossr50.listeners.WorldListener;
 | 
				
			||||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
					import com.gmail.nossr50.locale.LocaleLoader;
 | 
				
			||||||
import com.gmail.nossr50.metrics.MetricsManager;
 | 
					import com.gmail.nossr50.metrics.MetricsManager;
 | 
				
			||||||
@@ -52,14 +53,6 @@ import com.gmail.nossr50.util.player.UserManager;
 | 
				
			|||||||
import com.gmail.nossr50.util.spout.SpoutUtils;
 | 
					import com.gmail.nossr50.util.spout.SpoutUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class mcMMO extends JavaPlugin {
 | 
					public class mcMMO extends JavaPlugin {
 | 
				
			||||||
    /* Listeners */
 | 
					 | 
				
			||||||
    private final PlayerListener    playerListener    = new PlayerListener(this);
 | 
					 | 
				
			||||||
    private final BlockListener     blockListener     = new BlockListener(this);
 | 
					 | 
				
			||||||
    private final EntityListener    entityListener    = new EntityListener(this);
 | 
					 | 
				
			||||||
    private final InventoryListener inventoryListener = new InventoryListener(this);
 | 
					 | 
				
			||||||
    private final WorldListener     worldListener     = new WorldListener(this);
 | 
					 | 
				
			||||||
    private final SelfListener      selfListener      = new SelfListener();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* Managers */
 | 
					    /* Managers */
 | 
				
			||||||
    private static ChunkManager      placeStore;
 | 
					    private static ChunkManager      placeStore;
 | 
				
			||||||
    private static RepairableManager repairableManager;
 | 
					    private static RepairableManager repairableManager;
 | 
				
			||||||
@@ -321,7 +314,7 @@ public class mcMMO extends JavaPlugin {
 | 
				
			|||||||
            spoutEnabled = true;
 | 
					            spoutEnabled = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            SpoutConfig.getInstance();
 | 
					            SpoutConfig.getInstance();
 | 
				
			||||||
            SpoutUtils.registerCustomEvent();
 | 
					            getServer().getPluginManager().registerEvents(new SpoutListener(), this);
 | 
				
			||||||
            SpoutUtils.preCacheFiles();
 | 
					            SpoutUtils.preCacheFiles();
 | 
				
			||||||
            SpoutUtils.reloadSpoutPlayers(); // Handle spout players after a /reload
 | 
					            SpoutUtils.reloadSpoutPlayers(); // Handle spout players after a /reload
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -331,12 +324,12 @@ public class mcMMO extends JavaPlugin {
 | 
				
			|||||||
        PluginManager pluginManager = getServer().getPluginManager();
 | 
					        PluginManager pluginManager = getServer().getPluginManager();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Register events
 | 
					        // Register events
 | 
				
			||||||
        pluginManager.registerEvents(playerListener, this);
 | 
					        pluginManager.registerEvents(new PlayerListener(this), this);
 | 
				
			||||||
        pluginManager.registerEvents(blockListener, this);
 | 
					        pluginManager.registerEvents(new BlockListener(this), this);
 | 
				
			||||||
        pluginManager.registerEvents(entityListener, this);
 | 
					        pluginManager.registerEvents(new EntityListener(this), this);
 | 
				
			||||||
        pluginManager.registerEvents(inventoryListener, this);
 | 
					        pluginManager.registerEvents(new InventoryListener(this), this);
 | 
				
			||||||
        pluginManager.registerEvents(selfListener, this);
 | 
					        pluginManager.registerEvents(new SelfListener(), this);
 | 
				
			||||||
        pluginManager.registerEvents(worldListener, this);
 | 
					        pluginManager.registerEvents(new WorldListener(this), this);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void registerCustomRecipes() {
 | 
					    private void registerCustomRecipes() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,31 +13,24 @@ import org.bukkit.Material;
 | 
				
			|||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
import org.getspout.spoutapi.SpoutManager;
 | 
					import org.getspout.spoutapi.SpoutManager;
 | 
				
			||||||
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
 | 
					import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
 | 
				
			||||||
import org.getspout.spoutapi.player.FileManager;
 | 
					 | 
				
			||||||
import org.getspout.spoutapi.player.SpoutPlayer;
 | 
					import org.getspout.spoutapi.player.SpoutPlayer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.gmail.nossr50.mcMMO;
 | 
					import com.gmail.nossr50.mcMMO;
 | 
				
			||||||
import com.gmail.nossr50.config.AdvancedConfig;
 | 
					import com.gmail.nossr50.config.AdvancedConfig;
 | 
				
			||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
 | 
					import com.gmail.nossr50.datatypes.player.PlayerProfile;
 | 
				
			||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
 | 
					import com.gmail.nossr50.datatypes.skills.SkillType;
 | 
				
			||||||
import com.gmail.nossr50.listeners.SpoutListener;
 | 
					 | 
				
			||||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
					import com.gmail.nossr50.locale.LocaleLoader;
 | 
				
			||||||
import com.gmail.nossr50.util.StringUtils;
 | 
					import com.gmail.nossr50.util.StringUtils;
 | 
				
			||||||
import com.gmail.nossr50.util.player.UserManager;
 | 
					import com.gmail.nossr50.util.player.UserManager;
 | 
				
			||||||
import com.gmail.nossr50.util.skills.SkillUtils;
 | 
					import com.gmail.nossr50.util.skills.SkillUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class SpoutUtils {
 | 
					public class SpoutUtils {
 | 
				
			||||||
    private static mcMMO plugin = mcMMO.p;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public final static String spoutDirectory = mcMMO.getMainDirectory() + "Resources" + File.separator;
 | 
					    public final static String spoutDirectory = mcMMO.getMainDirectory() + "Resources" + File.separator;
 | 
				
			||||||
    public final static String hudDirectory = spoutDirectory + "HUD" + File.separator;
 | 
					    public final static String hudDirectory = spoutDirectory + "HUD" + File.separator;
 | 
				
			||||||
    public final static String hudStandardDirectory = hudDirectory + "Standard" + File.separator;
 | 
					    public final static String hudStandardDirectory = hudDirectory + "Standard" + File.separator;
 | 
				
			||||||
    public final static String hudRetroDirectory = hudDirectory + "Retro" + File.separator;
 | 
					    public final static String hudRetroDirectory = hudDirectory + "Retro" + File.separator;
 | 
				
			||||||
    public final static String soundDirectory = spoutDirectory + "Sound" + File.separator;
 | 
					    public final static String soundDirectory = spoutDirectory + "Sound" + File.separator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final static SpoutListener spoutListener = new SpoutListener();
 | 
					 | 
				
			||||||
//    public static Keyboard menuKey;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Write file to disk.
 | 
					     * Write file to disk.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -187,13 +180,6 @@ public class SpoutUtils {
 | 
				
			|||||||
        return files;
 | 
					        return files;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Register custom Spout events.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public static void registerCustomEvent() {
 | 
					 | 
				
			||||||
        plugin.getServer().getPluginManager().registerEvents(spoutListener, plugin);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Handle level-up notifications through Spout.
 | 
					     * Handle level-up notifications through Spout.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -497,7 +483,7 @@ public class SpoutUtils {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        spoutPlayer.sendNotification(LocaleLoader.getString("Spout.LevelUp.1"), LocaleLoader.getString("Spout.LevelUp.2", SkillUtils.getSkillName(skillType), profile.getSkillLevel(skillType)), mat);
 | 
					        spoutPlayer.sendNotification(LocaleLoader.getString("Spout.LevelUp.1"), LocaleLoader.getString("Spout.LevelUp.2", SkillUtils.getSkillName(skillType), profile.getSkillLevel(skillType)), mat);
 | 
				
			||||||
        SpoutManager.getSoundManager().playCustomSoundEffect(plugin, spoutPlayer, "level.wav", false);
 | 
					        SpoutManager.getSoundManager().playCustomSoundEffect(mcMMO.p, spoutPlayer, "level.wav", false);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -542,9 +528,7 @@ public class SpoutUtils {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void preCacheFiles() {
 | 
					    public static void preCacheFiles() {
 | 
				
			||||||
        extractFiles(); // Extract source materials
 | 
					        extractFiles();
 | 
				
			||||||
 | 
					        SpoutManager.getFileManager().addToPreLoginCache(mcMMO.p, getFiles());
 | 
				
			||||||
        FileManager FM = SpoutManager.getFileManager();
 | 
					 | 
				
			||||||
        FM.addToPreLoginCache(plugin, getFiles());
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user