WELP, Distraction Blocker kicked in

This commit is contained in:
alisolarflare 2016-11-30 00:31:41 -05:00
parent 13176ab288
commit 00402bd3a9
4 changed files with 8 additions and 80 deletions

View file

@ -17,7 +17,7 @@ commands:
description: Creative Boundaries Gamemode 0 - allows players to return to survival description: Creative Boundaries Gamemode 0 - allows players to return to survival
cbgm1: cbgm1:
description: Creative Boundaries Gamemode 1 - allows players to access creative within their towns. Creative is removed outside of towns so be careful description: Creative Boundaries Gamemode 1 - allows players to access creative within their towns. Creative is removed outside of towns so be careful
setdickmode: setforceboundaries:
description: Should players automatically return to creative when outside town borders? Dickmode says yes. description: Should players automatically return to creative when outside town borders? Dickmode says yes.
joinminigame: joinminigame:
description: Join a Button Minigame description: Join a Button Minigame

View file

@ -1,34 +0,0 @@
package alisolarflare.components.creativeboundaries.commands;
import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.ModCommand;
import alisolarflare.components.creativeboundaries.CreativeBoundariesComponent;
public class SetDickmode extends ModCommand{
boolean dickMode;
public SetDickmode(CreativeBoundariesComponent component){
this.dickMode = component.dickmode;
}
@Override
public boolean OnCommand(Player player, String label, String[] args) {
if(args.length < 1){
player.sendMessage("You must use True, False, 1, or 0 as arguments!");
return false;
}
String firstArgument = args[0];
if(firstArgument.startsWith("t") || firstArgument.equals("1")){
player.sendMessage("Dickmode has been turned on!");
dickMode = true;
return true;
}
if(firstArgument.startsWith("f") || firstArgument.equals("0")){
player.sendMessage("Dickmode has been turned off!");
dickMode = false;
return true;
}
return false;
}
}

View file

@ -1,7 +1,5 @@
package alisolarflare.components.creativeboundaries.listeners; package alisolarflare.components.creativeboundaries.listeners;
import java.util.List;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -14,49 +12,39 @@ import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock; import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse; import com.palmergames.bukkit.towny.object.TownyUniverse;
import alisolarflare.components.creativeboundaries.CreativeBoundariesComponent; import alisolarflare.components.creativeboundaries.CreativeBoundariesAPI;
public class PlotChangeListener implements Listener{ public class PlotChangeListener implements Listener{
private boolean dickmode;
private List<Player> cbCreatives;
public PlotChangeListener(CreativeBoundariesComponent module){
this.dickmode = module.dickmode;
this.cbCreatives = module.cbCreatives;
}
@EventHandler @EventHandler
public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){ public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){
Player player = plotEvent.getPlayer(); Player player = plotEvent.getPlayer();
if (dickmode == false){ if (CreativeBoundariesAPI.getforceBoundaries() == false){
return; return;
} }
if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){ if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){
return; return;
} }
if (!(cbCreatives.contains(plotEvent.getPlayer()))){ if (!(CreativeBoundariesAPI.isCBCreative(player))){
return; return;
} }
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation()); TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
if (tb == null) { if (tb == null) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!"); player.sendMessage("You have left your town boundaries!");
cbCreatives.remove(player); CreativeBoundariesAPI.toSurvival(player);
return; return;
} }
Town town; Town town;
try { try {
town = tb.getTown(); town = tb.getTown();
} catch (NotRegisteredException e) { } catch (NotRegisteredException e) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!"); player.sendMessage("You have left your town boundaries!!");
cbCreatives.remove(player); CreativeBoundariesAPI.toSurvival(player);
return; return;
} }
if (town == null) { if (town == null) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!!"); player.sendMessage("You have left your town boundaries!!!");
cbCreatives.remove(player); CreativeBoundariesAPI.toSurvival(player);
return; return;
} }
boolean townHasRes = false; boolean townHasRes = false;
@ -66,9 +54,8 @@ public class PlotChangeListener implements Listener{
} }
} }
if (!townHasRes){ if (!townHasRes){
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!!!"); player.sendMessage("You have left your town boundaries!!!!");
cbCreatives.remove(player); CreativeBoundariesAPI.toSurvival(player);
} }
} }
} }

View file

@ -1,25 +0,0 @@
package alisolarflare.components.easyuhc;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.architecture.Component;
public class EasyUHCComponent extends Component{
public Location lobbyLocation;
@Override
public void register(JavaPlugin plugin) {
// registerCommand(plugin, new ActivatePowers());
// registerCommand(plugin, new SetUHCLobby(this));
// registerCommand(plugin, new SetWorldBorders());
// registerCommand(plugin, new SetWorldBorders());
// registerCommand(plugin, new SpreadPlayers());
// registerCommand(plugin, new StartTimer());
// registerCommand(plugin, new StartUHC());
// registerCommand(plugin, new TeleportToUHC());
}
}