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
cbgm1:
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.
joinminigame:
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;
import java.util.List;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
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.TownyUniverse;
import alisolarflare.components.creativeboundaries.CreativeBoundariesComponent;
import alisolarflare.components.creativeboundaries.CreativeBoundariesAPI;
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
public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){
Player player = plotEvent.getPlayer();
if (dickmode == false){
if (CreativeBoundariesAPI.getforceBoundaries() == false){
return;
}
if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){
return;
}
if (!(cbCreatives.contains(plotEvent.getPlayer()))){
if (!(CreativeBoundariesAPI.isCBCreative(player))){
return;
}
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
if (tb == null) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!");
cbCreatives.remove(player);
CreativeBoundariesAPI.toSurvival(player);
return;
}
Town town;
try {
town = tb.getTown();
} catch (NotRegisteredException e) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!");
cbCreatives.remove(player);
CreativeBoundariesAPI.toSurvival(player);
return;
}
if (town == null) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!!");
cbCreatives.remove(player);
CreativeBoundariesAPI.toSurvival(player);
return;
}
boolean townHasRes = false;
@ -66,9 +54,8 @@ public class PlotChangeListener implements Listener{
}
}
if (!townHasRes){
player.setGameMode(GameMode.SURVIVAL);
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());
}
}