0

私は物事を非常に速く学び、理解することができますが、これはまだ私を混乱させています:

これはメイン クラス (DCFlags) にあります。

private WGCustomFlagsPlugin pluginWGCustomFlags;
private WorldGuardPlugin pluginWorldGuard;
private DCPvPToggle pluginDCPvPToggle;
private RegionListener listener;

public WGCustomFlagsPlugin getWGCFP(){
    return this.pluginWGCustomFlags;
}

public WorldGuardPlugin getWGP() {
    return this.pluginWorldGuard;
}

public DCPvPToggle getPPT(){
    return this.pluginDCPvPToggle;
}

public void onEnable(){
    this.pluginWorldGuard = Utils.getWorldGuard(this);
    this.pluginWGCustomFlags = Utils.getWGCustomFlags(this);
    this.pluginDCPvPToggle = Utils.getDCPvPToggle(this);
    this.listener = new RegionListener(this);
}

これは別のクラス(Utils)にあります:

public static WGCustomFlagsPlugin getWGCustomFlags(DCFlags plugin){
    Plugin wgcf = plugin.getServer().getPluginManager().getPlugin("WGCustomFlags");
    if ((wgcf == null) || (!(wgcf instanceof WGCustomFlagsPlugin))) {
        return null;
    }
    return (WGCustomFlagsPlugin)wgcf;
}

public static WorldGuardPlugin getWorldGuard(DCFlags plugin){
    Plugin wg = plugin.getServer().getPluginManager().getPlugin("WorldGuard");
    if ((wg == null) || (!(wg instanceof WorldGuardPlugin))) {
        return null;
    }
    return (WorldGuardPlugin)wg;
}

public static DCPvPToggle getDCPvPToggle(DCFlags plugin){
    Plugin ppt = plugin.getServer().getPluginManager().getPlugin("DCPvPToggle");
    if ((ppt == null) || (!(ppt instanceof DCPvPToggle))) {
        return null;
    }
    return (DCPvPToggle)ppt;
}

これは、他のプラグインのメソッドを使用できるようにするためであることはわかっていますが、「これ」とは何ですか。なぜそれが必要なのですか?

4

1 に答える 1