add flying boat module
This commit is contained in:
parent
c5630da10d
commit
cfdd1ed8eb
|
@ -15,17 +15,7 @@ import tc.oc.pgm.killreward.KillRewardModule;
|
|||
import tc.oc.pgm.blitz.BlitzModule;
|
||||
import tc.oc.pgm.map.MapModuleFactory;
|
||||
import tc.oc.pgm.map.StaticMethodMapModuleFactory;
|
||||
import tc.oc.pgm.modules.DiscardPotionBottlesModule;
|
||||
import tc.oc.pgm.modules.FriendlyFireRefundModule;
|
||||
import tc.oc.pgm.modules.InfoModule;
|
||||
import tc.oc.pgm.modules.InternalModule;
|
||||
import tc.oc.pgm.modules.ItemDestroyModule;
|
||||
import tc.oc.pgm.modules.MaxBuildHeightModule;
|
||||
import tc.oc.pgm.modules.MobsModule;
|
||||
import tc.oc.pgm.modules.ModifyBowProjectileModule;
|
||||
import tc.oc.pgm.modules.PlayableRegionModule;
|
||||
import tc.oc.pgm.modules.TimeLockModule;
|
||||
import tc.oc.pgm.modules.ToolRepairModule;
|
||||
import tc.oc.pgm.modules.*;
|
||||
import tc.oc.pgm.mutation.MutationMapModule;
|
||||
import tc.oc.pgm.pickup.PickupModule;
|
||||
import tc.oc.pgm.portals.PortalModule;
|
||||
|
@ -66,6 +56,7 @@ public class MapModulesManifest extends HybridManifest {
|
|||
install(new StaticMethodMapModuleFactory<ToolRepairModule>(){});
|
||||
install(new StaticMethodMapModuleFactory<PortalModule>(){});
|
||||
install(new StaticMethodMapModuleFactory<MaxBuildHeightModule>(){});
|
||||
install(new StaticMethodMapModuleFactory<FlyingBoatModule>(){});
|
||||
install(new StaticMethodMapModuleFactory<ModifyBowProjectileModule>(){});
|
||||
install(new StaticMethodMapModuleFactory<MobsModule>(){});
|
||||
install(new StaticMethodMapModuleFactory<HungerModule>(){});
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package tc.oc.pgm.modules;
|
||||
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||
import tc.oc.pgm.events.ListenerScope;
|
||||
import tc.oc.pgm.match.Match;
|
||||
import tc.oc.pgm.match.MatchModule;
|
||||
import tc.oc.pgm.match.MatchScope;
|
||||
|
||||
@ListenerScope(MatchScope.RUNNING)
|
||||
public class FlyingBoatMatchModule extends MatchModule implements Listener {
|
||||
|
||||
public FlyingBoatMatchModule(Match match) {
|
||||
super(match);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onBoatPlace(VehicleCreateEvent event) {
|
||||
Vehicle vehicle = event.getVehicle();
|
||||
if (vehicle instanceof Boat) {
|
||||
vehicle.setGravity(false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package tc.oc.pgm.modules;
|
||||
|
||||
import org.jdom2.Document;
|
||||
import org.jdom2.Element;
|
||||
import tc.oc.pgm.map.MapModule;
|
||||
import tc.oc.pgm.map.MapModuleContext;
|
||||
import tc.oc.pgm.match.Match;
|
||||
import tc.oc.pgm.match.MatchModuleFactory;
|
||||
import tc.oc.pgm.module.ModuleDescription;
|
||||
import tc.oc.pgm.xml.InvalidXMLException;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ModuleDescription(name="Flying Boats")
|
||||
public class FlyingBoatModule implements MapModule, MatchModuleFactory<FlyingBoatMatchModule> {
|
||||
@Override
|
||||
public FlyingBoatMatchModule createMatchModule(Match match) {
|
||||
return new FlyingBoatMatchModule(match);
|
||||
}
|
||||
|
||||
// ---------------------
|
||||
// ---- XML Parsing ----
|
||||
// ---------------------
|
||||
|
||||
public static FlyingBoatModule parse(MapModuleContext context, Logger logger, Document doc) throws InvalidXMLException {
|
||||
Element flyingboats = doc.getRootElement().getChild("flyingboats");
|
||||
if(flyingboats != null) {
|
||||
return new FlyingBoatModule();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue