Switch to Gradle. Use git log --follow for history.

This converts the project into a multi-module Gradle build.

By default, Git does not show history past a rename, so use git log
--follow to see further history.
This commit is contained in:
sk89q
2014-11-14 11:27:39 -08:00
parent 44559cde68
commit 7192780251
714 changed files with 333 additions and 834 deletions

View File

@ -0,0 +1,39 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event;
/**
* An abstract implementation of {@link Cancellable} that has all
* of {@link Cancellable}'s methods implemented.
*/
public abstract class AbstractCancellable implements Cancellable {
private boolean cancelled;
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@ -0,0 +1,42 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event;
/**
* Marks an event that has a cancellable state. The meaning of cancellation
* depends on the event.
*/
public interface Cancellable {
/**
* Returns whether the event has been cancelled.
*
* @return true if cancelled
*/
boolean isCancelled();
/**
* Set whether the event has been cancelled.
*
* @param cancelled true if cancelled
*/
void setCancelled(boolean cancelled);
}

View File

@ -0,0 +1,26 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event;
/**
* An abstract base class for all WorldEdit events.
*/
public abstract class Event {
}

View File

@ -0,0 +1,151 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event.extent;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.world.World;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.EditSession.Stage;
/**
* Raised (several times) when a new {@link EditSession} is being instantiated.
*
* <p></p>Block loggers, as well as block set interceptors, can use this event to wrap
* the given {@link Extent} with their own, which would allow them to intercept
* all changes made to the world. For example, the code below would wrap the
* existing extent with a custom one, and the custom extent would receive
* all method calls <strong>before</strong> the extent fetched from
* {@link #getExtent()} would.</p>
*
* <pre>
* event.setExtent(new MyExtent(event.getExtent())
* </pre>
*
* <p></p>This event is fired several times during the creation of a single
* {@link EditSession}, but {@link #getStage()} will differ each time.
* The stage determines at which point {@link Extent}s added to this event
* will be called. For example, if you inject an extent when the stage
* is set to {@link Stage#BEFORE_HISTORY}, then you can drop (or log) changes
* before the change has reached the history, reordering, and actual change
* extents, <em>but</em> that means that any changes made with
* {@link EditSession#rawSetBlock(Vector, BaseBlock)} will skip your
* custom {@link Extent} because that method bypasses history (and reorder).
* It is thus recommended that loggers intercept at {@link Stage#BEFORE_CHANGE}
* and block interceptors intercept at BOTH {@link Stage#BEFORE_CHANGE} and
* {@link Stage#BEFORE_HISTORY}.</p>
*/
public class EditSessionEvent extends Event {
private final World world;
private final Actor actor;
private final int maxBlocks;
private final Stage stage;
private Extent extent;
/**
* Create a new event.
*
* @param world the world
* @param actor the actor, or null if there is no actor specified
* @param maxBlocks the maximum number of block changes
* @param stage the stage
*/
public EditSessionEvent(@Nullable World world, Actor actor, int maxBlocks, Stage stage) {
this.world = world;
this.actor = actor;
this.maxBlocks = maxBlocks;
this.stage = stage;
}
/**
* Get the actor for this event.
*
* @return the actor, which may be null if unavailable
*/
public @Nullable Actor getActor() {
return actor;
}
/**
* Get the world.
*
* @return the world
*/
public @Nullable World getWorld() {
return world;
}
/**
* Get the maximum number of blocks that may be set.
*
* @return the maximum number of blocks, which is -1 if unlimited
*/
public int getMaxBlocks() {
return maxBlocks;
}
/**
* Get the {@link Extent} that can be wrapped.
*
* @return the extent
*/
public Extent getExtent() {
return extent;
}
/**
* Get the stage that is being wrapped.
*
* @return the stage
*/
public Stage getStage() {
return stage;
}
/**
* Set a new extent that should be used. It should wrap the extent
* returned from {@link #getExtent()}.
*
* @param extent the extent
*/
public void setExtent(Extent extent) {
checkNotNull(extent);
this.extent = extent;
}
/**
* Create a clone of this event with the given stage.
*
* @param stage the stage
* @return a new event
*/
public EditSessionEvent clone(Stage stage) {
return new EditSessionEvent(world, actor, maxBlocks, stage);
}
}

View File

@ -0,0 +1,91 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event.platform;
import com.sk89q.worldedit.event.Cancellable;
import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.Location;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Called when a block is interacted with.
*/
public class BlockInteractEvent extends Event implements Cancellable {
private final Actor cause;
private final Location location;
private final Interaction type;
private boolean cancelled;
/**
* Create a new event.
*
* @param cause the causing actor
* @param location the location of the block
* @param type the type of interaction
*/
public BlockInteractEvent(Actor cause, Location location, Interaction type) {
checkNotNull(cause);
checkNotNull(location);
checkNotNull(type);
this.cause = cause;
this.location = location;
this.type = type;
}
/**
* Get the cause of this event.
*
* @return the cause
*/
public Actor getCause() {
return cause;
}
/**
* Get the location of the block that was interacted with.
*
* @return the location
*/
public Location getLocation() {
return location;
}
/**
* Get the type of interaction.
*
* @return the type of interaction
*/
public Interaction getType() {
return type;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@ -0,0 +1,67 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event.platform;
import com.sk89q.worldedit.event.AbstractCancellable;
import com.sk89q.worldedit.extension.platform.Actor;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* This class is currently only for internal use. Do not post or catch this event.
*/
public class CommandEvent extends AbstractCancellable {
private final Actor actor;
private final String arguments;
/**
* Create a new instance.
*
* @param actor the player
* @param arguments the arguments
*/
public CommandEvent(Actor actor, String arguments) {
checkNotNull(actor);
checkNotNull(arguments);
this.actor = actor;
this.arguments = arguments;
}
/**
* Get the actor that issued the command.
*
* @return the actor that issued the command
*/
public Actor getActor() {
return actor;
}
/**
* Get the arguments.
*
* @return the arguments
*/
public String getArguments() {
return arguments;
}
}

View File

@ -0,0 +1,90 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event.platform;
import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extension.platform.Actor;
import java.util.Collections;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Posted when suggestions for auto-completion are requested for command input.
*/
public class CommandSuggestionEvent extends Event {
private final Actor actor;
private final String arguments;
private List<String> suggestions = Collections.emptyList();
/**
* Create a new instance.
*
* @param actor the player
* @param arguments the arguments
*/
public CommandSuggestionEvent(Actor actor, String arguments) {
checkNotNull(actor);
checkNotNull(arguments);
this.actor = actor;
this.arguments = arguments;
}
/**
* Get the actor that issued the command.
*
* @return the actor that issued the command
*/
public Actor getActor() {
return actor;
}
/**
* Get the arguments.
*
* @return the arguments
*/
public String getArguments() {
return arguments;
}
/**
* Get the list of suggestions that are to be presented.
*
* @return the list of suggestions
*/
public List<String> getSuggestions() {
return suggestions;
}
/**
* Set the list of suggestions that are to be presented.
*
* @param suggestions the list of suggestions
*/
public void setSuggestions(List<String> suggestions) {
checkNotNull(suggestions);
this.suggestions = suggestions;
}
}

View File

@ -0,0 +1,53 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event.platform;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.event.Event;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Raised when the configuration has been loaded or re-loaded.
*/
public class ConfigurationLoadEvent extends Event {
private final LocalConfiguration configuration;
/**
* Create a new instance.
*
* @param configuration the new configuration
*/
public ConfigurationLoadEvent(LocalConfiguration configuration) {
checkNotNull(configuration);
this.configuration = configuration;
}
/**
* Get the configuration.
*
* @return the configuration
*/
public LocalConfiguration getConfiguration() {
return configuration;
}
}

View File

@ -0,0 +1,37 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event.platform;
/**
* The type of input sent.
*/
public enum InputType {
/**
* Left click.
*/
PRIMARY,
/**
* Right click.
*/
SECONDARY
}

View File

@ -0,0 +1,37 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event.platform;
/**
* The type of interaction.
*/
public enum Interaction {
/**
* Refers to primary input usage (left click).
*/
HIT,
/**
* Refers to secondary input usage (right click).
*/
OPEN
}

View File

@ -0,0 +1,31 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event.platform;
import com.sk89q.worldedit.event.Event;
/**
* Fired when configuration has been loaded and the platform is in the
* intialization stage.
*
* <p>This event is fired once.</p>
*/
public class PlatformInitializeEvent extends Event {
}

View File

@ -0,0 +1,29 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event.platform;
import com.sk89q.worldedit.event.Event;
/**
* Raised when a platform thinks that all the platforms have had a chance to
* register themselves.
*/
public class PlatformReadyEvent extends Event {
}

View File

@ -0,0 +1,78 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.event.platform;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.event.Cancellable;
import com.sk89q.worldedit.event.Event;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Raised whenever a player sends input.
*/
public class PlayerInputEvent extends Event implements Cancellable {
private final Player player;
private final InputType inputType;
private boolean cancelled;
/**
* Create a new event.
*
* @param player the player
* @param inputType the input type
*/
public PlayerInputEvent(Player player, InputType inputType) {
checkNotNull(player);
checkNotNull(inputType);
this.player = player;
this.inputType = inputType;
}
/**
* Get the player that sent the input.
*
* @return the player
*/
public Player getPlayer() {
return player;
}
/**
* Get the type of input sent.
*
* @return the input sent
*/
public InputType getInputType() {
return inputType;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}